WM: always reset message-bus on file load
Previously this was only happening when "Load UI" was enabled, making it difficult for Python script authors to know when re-registering subscribers was needed.
This commit is contained in:
parent
f01c4f27f9
commit
bff3dcf330
|
@ -204,6 +204,16 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
|
|||
WM_event_remove_handlers(C, &win->modalhandlers);
|
||||
ED_screen_exit(C, win, WM_window_get_active_screen(win));
|
||||
}
|
||||
|
||||
/* NOTE(@campbellbarton): Clear the message bus so it's always cleared on file load.
|
||||
* Otherwise it's cleared when "Load UI" is set (see #USER_FILENOUI & #wm_close_and_free).
|
||||
* However it's _not_ cleared when the UI is kept. This complicates use from add-ons
|
||||
* which can re-register subscribers on file-load. To support this use case,
|
||||
* it's best to have predictable behavior - always clear. */
|
||||
if (wm->message_bus != NULL) {
|
||||
WM_msgbus_destroy(wm->message_bus);
|
||||
wm->message_bus = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* reset active window */
|
||||
|
|
Loading…
Reference in New Issue