Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-10-08 15:41:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-10-08 16:55:47 +0300
commitbff3dcf3307a475916781994027dbd7d36f31b98 (patch)
treef439dba44d0b9cb9232a5b07d16c7b2f6f694d1a /source/blender/windowmanager/intern/wm_files.c
parentf01c4f27f978d3c70ca01515e338d7edd6e59b32 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a5ebf988edd..564f869581a 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -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 */