From b6b17338c24011d078e012329ec21c61c61c96de Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 2 May 2018 17:35:26 +0200 Subject: 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. --- source/blender/editors/interface/interface_region_tooltip.c | 5 +++++ 1 file changed, 5 insertions(+) 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); -- cgit v1.2.3