Fix T83888: Ctrl F in Asset Browser crashes blender

In case of being in Asset browsing mode, the search field is located in
the header (RGN_TYPE_HEADER not RGN_TYPE_UI as for file browsing mode).
To be future proof, now iterate all regions and act if the
"filter_search" can be activated.

Maniphest Tasks: T83888

Differential Revision: https://developer.blender.org/D9882
This commit is contained in:
Philipp Oeser 2020-12-17 13:41:10 +01:00
parent 3fc07d1e74
commit fed995ced5
Notes: blender-bot 2023-02-13 20:09:13 +01:00
Referenced by issue #83888, Ctrl F in Asset Browser crashes blender
1 changed files with 10 additions and 3 deletions

View File

@ -2778,13 +2778,20 @@ void FILE_OT_delete(struct wmOperatorType *ot)
static int file_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *area = CTX_wm_area(C);
ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_UI);
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_active_params(sfile);
ARegion *region_ctx = CTX_wm_region(C);
CTX_wm_region_set(C, region);
UI_textbutton_activate_rna(C, region, params, "filter_search");
if (area) {
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
CTX_wm_region_set(C, region);
if (UI_textbutton_activate_rna(C, region, params, "filter_search")) {
break;
}
}
}
CTX_wm_region_set(C, region_ctx);
return OPERATOR_FINISHED;