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 3f3b4745b6.
This commit is contained in:
Campbell Barton 2021-04-11 12:14:42 +10:00
parent 0e3bc2e321
commit 947ba0d27b
Notes: blender-bot 2023-02-14 00:06:52 +01:00
Referenced by issue #87355, Crash using menu search from the top bar
1 changed files with 9 additions and 2 deletions

View File

@ -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) {