[Bf-blender-cvs] [999c5c5c8d4] master: Fix (studio-reported) crash when linking/appending data in some cases.

Bastien Montagne noreply at git.blender.org
Mon Aug 29 17:25:14 CEST 2022


Commit: 999c5c5c8d44943f1df3cbcf227e59422d990acf
Author: Bastien Montagne
Date:   Mon Aug 29 17:23:42 2022 +0200
Branches: master
https://developer.blender.org/rB999c5c5c8d44943f1df3cbcf227e59422d990acf

Fix (studio-reported) crash when linking/appending data in some cases.

Recent refactor (rB7be1c8bbae76f49f) removed a null check in WM code,
that is mandatory in some cases like e.g. liboverride apply code on
linked data.

===================================================================

M	source/blender/windowmanager/intern/wm_event_system.cc

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc
index d136d3831c9..2bba0ac802d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.cc
+++ b/source/blender/windowmanager/intern/wm_event_system.cc
@@ -280,6 +280,16 @@ static bool note_cmp_for_queue_fn(const void *a, const void *b)
 
 void WM_event_add_notifier_ex(wmWindowManager *wm, const wmWindow *win, uint type, void *reference)
 {
+  if (wm == nullptr) {
+    /* There may be some cases where e.g. `G_MAIN` is not actually the real current main, but some
+     * other temporary one (e.g. during liboverride processing over linked data), leading to null
+     * window manager.
+     *
+     * This is fairly bad and weak, but unfortunately RNA does not have any way to operate over
+     * another main than G_MAIN currently. */
+    return;
+  }
+
   wmNotifier note_test = {nullptr};
 
   note_test.window = win;



More information about the Bf-blender-cvs mailing list