[Bf-blender-cvs] [376bc88dc02] blender2.8: Fix leak of manipulator tooltip timers.

Brecht Van Lommel noreply at git.blender.org
Tue Jun 12 17:07:28 CEST 2018


Commit: 376bc88dc027a8dfc5bd2f92253b17738b825c39
Author: Brecht Van Lommel
Date:   Tue Jun 12 16:57:01 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB376bc88dc027a8dfc5bd2f92253b17738b825c39

Fix leak of manipulator tooltip timers.

This was causing performance degradation over time in posing, as the
manipulator recomputes the center locations for every event.

Ref T55442.

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

M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_tooltip.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
M	source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index a6b76796c7f..00f5f6c1368 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2386,8 +2386,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
 				if (event->type == MOUSEMOVE && !wm_manipulatormap_modal_get(mmap)) {
 					int part;
 					mpr = wm_manipulatormap_highlight_find(mmap, C, event, &part);
-					wm_manipulatormap_highlight_set(mmap, C, mpr, part);
-					if (mpr != NULL) {
+					if (wm_manipulatormap_highlight_set(mmap, C, mpr, part) && mpr != NULL) {
 						WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_manipulatormap_tooltip_init);
 					}
 				}
diff --git a/source/blender/windowmanager/intern/wm_tooltip.c b/source/blender/windowmanager/intern/wm_tooltip.c
index 6096317b582..94a44a97afd 100644
--- a/source/blender/windowmanager/intern/wm_tooltip.c
+++ b/source/blender/windowmanager/intern/wm_tooltip.c
@@ -41,6 +41,8 @@ void WM_tooltip_timer_init(
         bContext *C, wmWindow *win, ARegion *ar,
         wmTooltipInitFn init)
 {
+	WM_tooltip_timer_clear(C, win);
+
 	bScreen *screen = WM_window_get_active_screen(win);
 	wmWindowManager *wm = CTX_wm_manager(C);
 	if (screen->tool_tip == NULL) {
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index ab8c797df69..0b4b1f5e9e1 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -846,7 +846,7 @@ bool WM_manipulatormap_cursor_set(const wmManipulatorMap *mmap, wmWindow *win)
 	return false;
 }
 
-void wm_manipulatormap_highlight_set(
+bool wm_manipulatormap_highlight_set(
         wmManipulatorMap *mmap, const bContext *C, wmManipulator *mpr, int part)
 {
 	if ((mpr != mmap->mmap_context.highlight) ||
@@ -881,7 +881,11 @@ void wm_manipulatormap_highlight_set(
 			ARegion *ar = CTX_wm_region(C);
 			ED_region_tag_redraw(ar);
 		}
+
+		return true;
 	}
+
+	return false;
 }
 
 wmManipulator *wm_manipulatormap_highlight_get(wmManipulatorMap *mmap)
diff --git a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
index 87cf711a60b..7b294b9320f 100644
--- a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
+++ b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
@@ -77,7 +77,7 @@ void wm_manipulatormap_handler_context(bContext *C, struct wmEventHandler *handl
 struct wmManipulator *wm_manipulatormap_highlight_find(
         struct wmManipulatorMap *mmap, bContext *C, const struct wmEvent *event,
         int *r_part);
-void wm_manipulatormap_highlight_set(
+bool wm_manipulatormap_highlight_set(
         struct wmManipulatorMap *mmap, const bContext *C,
         struct wmManipulator *mpr, int part);
 struct wmManipulator *wm_manipulatormap_highlight_get(struct wmManipulatorMap *mmap);



More information about the Bf-blender-cvs mailing list