[Bf-blender-cvs] [f271c87] wiggly-widgets: Fix leak freeing widget which was highlighted

Campbell Barton noreply at git.blender.org
Tue Jan 5 06:33:03 CET 2016


Commit: f271c8772e75ff30a796bc14e735638f769442ce
Author: Campbell Barton
Date:   Tue Jan 5 16:24:13 2016 +1100
Branches: wiggly-widgets
https://developer.blender.org/rBf271c8772e75ff30a796bc14e735638f769442ce

Fix leak freeing widget which was highlighted

===================================================================

M	source/blender/windowmanager/intern/wm_widgets.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_widgets.c b/source/blender/windowmanager/intern/wm_widgets.c
index d8243d2..ee146f8 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -351,13 +351,15 @@ void WM_widgetmap_widgets_update(const bContext *C, wmWidgetMap *wmap)
 			if (highlighted_new) {
 				BLI_assert(widget_compare(highlighted, highlighted_new));
 				widget_highlight_update(wmap, highlighted, highlighted_new);
-				wm_widget_delete(NULL, highlighted);
 			}
-			/* if we didn't find a highlighted widget, delete the old one here */
 			else {
-				MEM_SAFE_FREE(highlighted);
+				/* if we didn't find a highlighted widget, delete the old one here,
+				 * happens when switching modes while the cursor is hovering over a widget for eg. */
 				wmap->wmap_context.highlighted_widget = NULL;
 			}
+
+			wm_widget_delete(NULL, highlighted);
+			highlighted = NULL;
 		}
 
 		if (wmap->wmap_context.selected_widgets) {




More information about the Bf-blender-cvs mailing list