[Bf-blender-cvs] [947ba0d27bf] master: Fix T87355: Crash using menu search from the top bar

Campbell Barton noreply at git.blender.org
Sun Apr 11 04:19:53 CEST 2021


Commit: 947ba0d27bf58b3efdae9617cb87a3dba0dbc0dd
Author: Campbell Barton
Date:   Sun Apr 11 12:14:42 2021 +1000
Branches: master
https://developer.blender.org/rB947ba0d27bf58b3efdae9617cb87a3dba0dbc0dd

Fix T87355: Crash using menu search from the top bar

Menu search used an area with a NULL data pointer,
replace this with a dummy pointer.

Caused by 3f3b4745b6ad99a0503fba4793d0f1febedadebc.

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

M	source/blender/editors/interface/interface_template_search_menu.c

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

diff --git a/source/blender/editors/interface/interface_template_search_menu.c b/source/blender/editors/interface/interface_template_search_menu.c
index ff42d434f29..df19bdb650e 100644
--- a/source/blender/editors/interface/interface_template_search_menu.c
+++ b/source/blender/editors/interface/interface_template_search_menu.c
@@ -510,11 +510,19 @@ static struct MenuSearch_Data *menu_items_from_ui_create(
   const char *global_menu_prefix = NULL;
 
   if (include_all_areas) {
+    bScreen *screen = WM_window_get_active_screen(win);
+
     /* First create arrays for ui_type. */
     PropertyRNA *prop_ui_type = NULL;
     {
+      /* This must be a valid pointer, with only it's type checked. */
+      ScrArea area_dummy = {
+          /* Anything besides #SPACE_EMPTY is fine,
+           * as this value is only included in the enum when set. */
+          .spacetype = SPACE_TOPBAR,
+      };
       PointerRNA ptr;
-      RNA_pointer_create(NULL, &RNA_Area, NULL, &ptr);
+      RNA_pointer_create(&screen->id, &RNA_Area, &area_dummy, &ptr);
       prop_ui_type = RNA_struct_find_property(&ptr, "ui_type");
       RNA_property_enum_items(C,
                               &ptr,
@@ -529,7 +537,6 @@ static struct MenuSearch_Data *menu_items_from_ui_create(
       }
     }
 
-    bScreen *screen = WM_window_get_active_screen(win);
     LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
       ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
       if (region != NULL) {



More information about the Bf-blender-cvs mailing list