diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 7fe9f3a8ab4..9df9afcb064 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -428,6 +428,7 @@ typedef struct wmGesture { /* free pointer to use for operator allocs (if set, its freed on exit)*/ void *userdata; + bool userdata_free; } wmGesture; /* ************** wmEvent ************************ */ diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 30d1fa9d5ca..77030fac5ea 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -71,6 +71,7 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type) gesture->type = type; gesture->event_type = event->type; gesture->swinid = ar->swinid; /* means only in area-region context! */ + gesture->userdata_free = true; /* Free if userdata is set. */ wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy); @@ -114,7 +115,7 @@ void WM_gesture_end(bContext *C, wmGesture *gesture) win->tweak = NULL; BLI_remlink(&win->gesture, gesture); MEM_freeN(gesture->customdata); - if (gesture->userdata) { + if (gesture->userdata && gesture->userdata_free) { MEM_freeN(gesture->userdata); } MEM_freeN(gesture); |