[Bf-blender-cvs] [7a2b1815917] master: Fix T94041: Loading a new file gives crash while rendering in viewport

Sergey Sharybin noreply at git.blender.org
Wed Jan 12 10:12:30 CET 2022


Commit: 7a2b18159170b91694fd7c64825a699314fae3ca
Author: Sergey Sharybin
Date:   Tue Jan 11 11:27:35 2022 +0100
Branches: master
https://developer.blender.org/rB7a2b18159170b91694fd7c64825a699314fae3ca

Fix T94041: Loading a new file gives crash while rendering in viewport

The issue was caused by Cycles display driver not being able to restore
window's OpenGL context after disposing Cycles-side OpenGL context.

This is due to the window OpenGL re-activation needing to access window
manager which gets cleared out form global main during file reading.

Defer clearing window manager from the global main to until after all
screens are "exited". This allows Cycles to properly stop rendering,
dispose its OpenGL context, and restore window's drawable context.

It is unclear why it was required to clear window manager list early
on. Guess is that it comes from an original code in a1c8543f2ac where
there was an early return which then got replaced with an actual logic
without changing the order of de-initialization and window manager list
clear.

Differential Revision: https://developer.blender.org/D13799

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

M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 99bab3ae23d..344f4959a93 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -193,7 +193,6 @@ bool wm_file_or_session_data_has_unsaved_changes(const Main *bmain, const wmWind
 static void wm_window_match_init(bContext *C, ListBase *wmlist)
 {
   *wmlist = G_MAIN->wm;
-  BLI_listbase_clear(&G_MAIN->wm);
 
   wmWindow *active_win = CTX_wm_window(C);
 
@@ -220,6 +219,8 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
     }
   }
 
+  BLI_listbase_clear(&G_MAIN->wm);
+
   /* reset active window */
   CTX_wm_window_set(C, active_win);



More information about the Bf-blender-cvs mailing list