[Bf-blender-cvs] [b6b17338c24] blender2.8: Fix mysterious crash on tooltips
Dalai Felinto
noreply at git.blender.org
Wed May 2 17:37:09 CEST 2018
Commit: b6b17338c24011d078e012329ec21c61c61c96de
Author: Dalai Felinto
Date: Wed May 2 17:35:26 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb6b17338c24011d078e012329ec21c61c61c96de
Fix mysterious crash on tooltips
This was a hard to reproduce bug, but it happens often enough.
Basically the tooltip of the active tool was been invoked when
context had no valid ScrArea which would lead to a crash.
We now just return no tooltip in these cases.
===================================================================
M source/blender/editors/interface/interface_region_tooltip.c
===================================================================
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index 449e783b03e..d016deb26cb 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -901,6 +901,11 @@ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b
RNA_string_get(but->opptr, "keymap", keymap);
if (keymap[0]) {
ScrArea *sa = CTX_wm_area(C);
+ /* It happens in rare cases, for tooltips originated from the toolbar.
+ * It is hard to reproduce, but it happens when the mouse is nowhere near the actual tool. */
+ if (sa == NULL) {
+ return NULL;
+ }
wmKeyMap *km = WM_keymap_find_all(C, keymap, sa->spacetype, RGN_TYPE_WINDOW);
if (km != NULL) {
data = ui_tooltip_data_from_keymap(C, km);
More information about the Bf-blender-cvs
mailing list