Commit: 8876e3aae25ad0e74baf362413b0fd113aa5b638
Author: Clément Foucault
Date:   Mon Jul 23 17:44:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8876e3aae25ad0e74baf362413b0fd113aa5b638

Fix assert when loading file with multiple windows opened

... or when loading a file when having more windows opened than the file
itself.

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

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

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

diff --git a/source/blender/windowmanager/intern/wm_files.c 
b/source/blender/windowmanager/intern/wm_files.c
index c191255cd21..02c24aac60e 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -279,6 +279,10 @@ static void wm_window_match_replace_by_file_wm(
        wm->initialized = 0;
        wm->winactive = NULL;
 
+       /* Clearing drawable of before deleting any context
+        * to avoid clearing the wrong wm. */
+       wm_window_clear_drawable(oldwm);
+
        /* only first wm in list has ghostwins */
        for (wmWindow *win = wm->windows.first; win; win = win->next) {
                for (wmWindow *oldwin = oldwm->windows.first; oldwin; oldwin = 
oldwin->next) {
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index c1006db34ef..4b26532742b 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -123,7 +123,6 @@ static struct WMInitStruct {
 /* ******** win open & close ************ */
 
 static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool 
activate);
-static void wm_window_clear_drawable(wmWindowManager *wm);
 
 /* XXX this one should correctly check for apple top header...
  * done for Cocoa : returns window contents (and not frame) max size*/
@@ -202,7 +201,6 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, 
wmWindow *win)
                GHOST_DisposeWindow(g_system, win->ghostwin);
                win->ghostwin = NULL;
                win->gpuctx = NULL;
-
        }
 }
 
@@ -1103,7 +1101,7 @@ static void wm_window_set_drawable(wmWindowManager *wm, 
wmWindow *win, bool acti
        immActivate();
 }
 
-static void wm_window_clear_drawable(wmWindowManager *wm)
+void wm_window_clear_drawable(wmWindowManager *wm)
 {
        if (wm->windrawable) {
                BLF_batch_reset();
diff --git a/source/blender/windowmanager/wm_window.h 
b/source/blender/windowmanager/wm_window.h
index 385d61217ad..4fd5d66fb43 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -57,6 +57,7 @@ void          wm_window_ghostwindows_remove_invalid(bContext 
*C, wmWindowManager *wm);
 void           wm_window_process_events        (const bContext *C);
 void           wm_window_process_events_nosleep(void);
 
+void           wm_window_clear_drawable(wmWindowManager *wm);
 void           wm_window_make_drawable(wmWindowManager *wm, wmWindow *win);
 void           wm_window_reset_drawable(void);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to