diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-19 23:31:19 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-19 23:35:48 +0300 |
commit | c8df6f2cf9df28e57f2d19b8ec392721554b2ecc (patch) | |
tree | 4e5ec234a0be34b8977821273b644e5534980ebc /source/blender/windowmanager | |
parent | 27642f24e1cbe5fd9abe16f6f3abef1b018ace30 (diff) |
Fix Preferences opens file browser in wrong window
Steps to reproduce were:
* Open Preferences in a new window (Edit -> Preferences)
* Set file browsers to open fullscreen (Interface->Editors->Temporary
Windows)
* Open a file browser in the Preferences (e.g. Add-ons -> Install)
The file browser would be opened in the parent window, rather than the
preferences.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 47b77cf435b..fb91a65a7cc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3546,10 +3546,12 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); const bool is_temp_screen = WM_window_is_temp_screen(win); - /* Don't add the file handler to the temporary window, or else it owns the handlers for itself, - * causing dangling pointers once it's destructed through a handler. It has a parent which should - * hold the handlers itself. */ - ListBase *modalhandlers = is_temp_screen ? &win->parent->modalhandlers : &win->modalhandlers; + const bool opens_window = (U.filebrowser_display_type == USER_TEMP_SPACE_DISPLAY_WINDOW); + /* Don't add the file handler to the temporary window if one is opened, or else it owns the + * handlers for itself, causing dangling pointers once it's destructed through a handler. It has + * a parent which should hold the handlers itself. */ + ListBase *modalhandlers = (is_temp_screen && opens_window) ? &win->parent->modalhandlers : + &win->modalhandlers; /* Close any popups, like when opening a file browser from the splash. */ UI_popup_handlers_remove_all(C, modalhandlers); |