forked from bartvdbraak/blender
Fix memory leak with image drag and drop
Dragging an image from the file selector into the sequencer was leaking memory. Regression in b5d778a7d4072bfb091198a2094890157a6d017b.
This commit is contained in:
parent
5d99199880
commit
37c5552742
@ -1993,7 +1993,12 @@ static bool ui_but_drag_init(bContext *C,
|
||||
}
|
||||
else {
|
||||
wmDrag *drag = WM_event_start_drag(
|
||||
C, but->icon, but->dragtype, but->dragpoin, ui_but_value_get(but), WM_DRAG_NOP);
|
||||
C,
|
||||
but->icon,
|
||||
but->dragtype,
|
||||
but->dragpoin,
|
||||
ui_but_value_get(but),
|
||||
(but->dragflag & UI_BUT_DRAGPOIN_FREE) ? WM_DRAG_FREE_DATA : WM_DRAG_NOP);
|
||||
/* wmDrag has ownership over dragpoin now, stop messing with it. */
|
||||
but->dragpoin = NULL;
|
||||
|
||||
|
@ -150,6 +150,10 @@ wmDrag *WM_event_start_drag(
|
||||
switch (type) {
|
||||
case WM_DRAG_PATH:
|
||||
BLI_strncpy(drag->path, poin, FILE_MAX);
|
||||
/* As the path is being copied, free it immediately as `drag` wont "own" the data. */
|
||||
if (flags & WM_DRAG_FREE_DATA) {
|
||||
MEM_freeN(poin);
|
||||
}
|
||||
break;
|
||||
case WM_DRAG_ID:
|
||||
if (poin) {
|
||||
|
Loading…
Reference in New Issue
Block a user