diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-12-17 15:41:10 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-12-17 18:05:20 +0300 |
commit | fed995ced5b0b963bb42de5aa3e93a3c5dc91aac (patch) | |
tree | 5229c9b46c8875bbb13f5b88e85489fb6575fdc8 /source/blender/editors/space_file/file_ops.c | |
parent | 3fc07d1e7482a6472bf6e34616ebe7b616189274 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index be4577bcba7..3730174a6c7 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -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; |