diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-18 08:40:49 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-18 08:55:45 +0300 |
commit | 0aaff9a07d3bdf8588cef15d502aeb4fdab22e5e (patch) | |
tree | 4315bb9a01e376be24c352ac28a551935d1922ef /source/blender/windowmanager/intern/wm.c | |
parent | 7be1c8bbae76f49fed96a6b0ca0cf387e002d1a5 (diff) |
WM: optimize adding notifier duplication check
Use a GSet to check for duplicate notifiers, for certain Python scripts
checking for duplicate notifiers added considerable overhead.
This is an alternative to D15129 with fewer chances to existing logic.
Diffstat (limited to 'source/blender/windowmanager/intern/wm.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 0d74bc259f4..9b3a0d39dfa 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -15,6 +15,7 @@ #include <stddef.h> #include <string.h> +#include "BLI_ghash.h" #include "BLI_sys_types.h" #include "DNA_windowmanager_types.h" @@ -193,6 +194,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id) BLI_listbase_clear(&wm->operators); BLI_listbase_clear(&wm->paintcursors); BLI_listbase_clear(&wm->notifier_queue); + wm->notifier_queue_set = NULL; BKE_reports_init(&wm->reports, RPT_STORE); BLI_listbase_clear(&wm->keyconfigs); @@ -580,6 +582,10 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm) } BLI_freelistN(&wm->notifier_queue); + if (wm->notifier_queue_set) { + BLI_gset_free(wm->notifier_queue_set, NULL); + wm->notifier_queue_set = NULL; + } if (wm->message_bus != NULL) { WM_msgbus_destroy(wm->message_bus); |