DragMessage() makes a copy of the passed message. We were leaking inside

BTextView::_InitiateDrag().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2008-01-30 09:22:49 +00:00
parent acb25a9724
commit bc7e472d88
+6 -6
View File
@@ -1,11 +1,11 @@
/* /*
* Copyright 2001-2007, Haiku Inc. * Copyright 2001-2008, Haiku Inc.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Hiroshi Lockheimer (BTextView is based on his STEEngine) * Hiroshi Lockheimer (BTextView is based on his STEEngine)
* Marc Flerackers ([email protected]) * Marc Flerackers ([email protected])
* Stefano Ceccherini ([email protected]) * Stefano Ceccherini ([email protected])
*/ */
/*! BTextView displays and manages styled text. */ /*! BTextView displays and manages styled text. */
@@ -3912,16 +3912,16 @@ BTextView::_TrackDrag(BPoint where)
void void
BTextView::_InitiateDrag() BTextView::_InitiateDrag()
{ {
BMessage *dragMessage = new BMessage(B_MIME_DATA); BMessage dragMessage(B_MIME_DATA);
BBitmap *dragBitmap = NULL; BBitmap *dragBitmap = NULL;
BPoint bitmapPoint; BPoint bitmapPoint;
BHandler *dragHandler = NULL; BHandler *dragHandler = NULL;
GetDragParameters(dragMessage, &dragBitmap, &bitmapPoint, &dragHandler); GetDragParameters(&dragMessage, &dragBitmap, &bitmapPoint, &dragHandler);
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
if (dragBitmap != NULL) if (dragBitmap != NULL)
DragMessage(dragMessage, dragBitmap, bitmapPoint, dragHandler); DragMessage(&dragMessage, dragBitmap, bitmapPoint, dragHandler);
else { else {
BRegion region; BRegion region;
GetTextRegion(fSelStart, fSelEnd, &region); GetTextRegion(fSelStart, fSelEnd, &region);
@@ -3930,7 +3930,7 @@ BTextView::_InitiateDrag()
if (!bounds.Contains(dragRect)) if (!bounds.Contains(dragRect))
dragRect = bounds & dragRect; dragRect = bounds & dragRect;
DragMessage(dragMessage, dragRect, dragHandler); DragMessage(&dragMessage, dragRect, dragHandler);
} }
BMessenger messenger(this); BMessenger messenger(this);