From 8f73c97d4222e32f20d7faf96f1fb388970a247d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 10 Mar 2009 14:32:59 +0000 Subject: [PATCH] In the assignment operator, watch out if the passed message is ourself. Fixes a crash in WonderBrush when dragging images over the layer list to import them and triggering auto-scrolling. WonderBrush caches the drag message and appearantly calls it's own MouseMoved() hood with the cached message from within the auto-scrolling code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29464 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Message.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index 7f6ec522eb..6933a70bfe 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -164,6 +164,9 @@ BMessage::operator=(const BMessage &other) { DEBUG_FUNCTION_ENTER; + if (this == &other) + return *this; + _Clear(); fHeader = (message_header *)malloc(sizeof(message_header)); @@ -2080,8 +2083,8 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token, fHeader->flags |= MESSAGE_FLAG_REPLY_DONE; } - // we need to do this last because it is possible our - // message might be destroyed after it's enqueued in the + // we need to do this last because it is possible our + // message might be destroyed after it's enqueued in the // target looper. Thus we don't want to do any ops that depend on // members of this after the enqueue. if (direct != NULL) {