Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-05-02 18:35:26 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-05-02 18:37:05 +0300
commitb6b17338c24011d078e012329ec21c61c61c96de (patch)
tree69f0a47b0e468711e6de081e42088a4ea573e4c3
parent3fa6b6ed4c7ad98d0002032e9ef77fa4024f28a5 (diff)
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.
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c5
1 files changed, 5 insertions, 0 deletions
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);