diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-01 12:59:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-01 12:59:50 +0300 |
commit | ca0dcd830c5e880b9ea25d4b95a581b2aaeef4e4 (patch) | |
tree | c1c1e1c1e656d66954d65fba00915a1a3700926b | |
parent | 186ac842103f410c663dfab440c9e40038dcea5b (diff) |
Fix T75222: Crash activating menu search
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 40824cbeb52..1e6f03c2b0c 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -208,7 +208,7 @@ class TOPBAR_MT_editor_menus(Menu): layout = self.layout # Allow calling this menu directly (this might not be a header area). - if getattr(context.area, "show_menus"): + if getattr(context.area, "show_menus", False): layout.menu("TOPBAR_MT_app", text="", icon='BLENDER') else: layout.menu("TOPBAR_MT_app", text="Blender") diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index d7377a0e56e..c750187d7a3 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6827,12 +6827,15 @@ static void menu_types_add_from_keymap_items(bContext *C, { wmWindowManager *wm = CTX_wm_manager(C); ListBase *handlers[] = { - ®ion->handlers, - &sa->handlers, + region ? ®ion->handlers : NULL, + sa ? &sa->handlers : NULL, &win->handlers, }; for (int handler_index = 0; handler_index < ARRAY_SIZE(handlers); handler_index++) { + if (handlers[handler_index] == NULL) { + continue; + } LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers[handler_index]) { /* During this loop, ui handlers for nested menus can tag multiple handlers free. */ if (handler_base->flag & WM_HANDLER_DO_FREE) { @@ -7092,11 +7095,15 @@ static struct MenuSearch_Data *menu_items_from_ui_create(bContext *C, menu_items_from_ui_create_item_from_button(data, memarena, mt, drawstr_submenu, sub_but); } - BLI_remlink(®ion->uiblocks, sub_block); + if (region) { + BLI_remlink(®ion->uiblocks, sub_block); + } UI_block_free(NULL, sub_block); } } - BLI_remlink(®ion->uiblocks, block); + if (region) { + BLI_remlink(®ion->uiblocks, block); + } UI_block_free(NULL, block); /* Add key-map items as a second pass, |