Commit: 03d1f08282cfb1e7b579d999ecde12f1bee25c81
Author: Germano
Date:   Thu Feb 22 13:22:28 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB03d1f08282cfb1e7b579d999ecde12f1bee25c81

WM: Make sure that immediate mode is active before deactivate it

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

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

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

diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 3268841334d..103f8d580c1 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -175,13 +175,19 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, 
wmWindow *win)
 {
        if (win->ghostwin) {
                /* We need this window's opengl context active to discard it. */
-               wm_window_make_drawable(wm, win);
+               GHOST_ActivateWindowDrawingContext(win->ghostwin);
+               GWN_context_active_set(win->gwnctx);
+
                /* Delete local gawain objects.  */
                GWN_context_discard(win->gwnctx);
 
                GHOST_DisposeWindow(g_system, win->ghostwin);
                win->ghostwin = NULL;
                win->gwnctx = NULL;
+
+               /* prevents non-drawable state of main windows (bugs #22967 and 
#25071, possibly #22477 too) */
+               wm->windrawable = NULL;
+               wm->winactive = NULL;
        }
 }
 
@@ -222,11 +228,6 @@ void wm_window_free(bContext *C, wmWindowManager *wm, 
wmWindow *win)
 
        wm_ghostwindow_destroy(wm, win);
 
-       /* always set drawable and active to NULL,
-        * prevents non-drawable state of main windows (bugs #22967 and #25071, 
possibly #22477 too) */
-       wm->windrawable = NULL;
-       wm->winactive = NULL;
-
        BKE_workspace_instance_hook_free(G.main, win->workspace_hook);
        MEM_freeN(win->stereo3d_format);
 
@@ -378,9 +379,20 @@ void wm_window_close(bContext *C, wmWindowManager *wm, 
wmWindow *win)
                if (screen) {
                        ED_screen_exit(C, win, screen);
                }
-               
+
+               if (tmpwin) {
+                       immDeactivate();
+               }
+
                wm_window_free(C, wm, win);
-       
+
+               /* keep imediatemode active before the next 
`wm_window_make_drawable` call */
+               if (tmpwin) {
+                       GHOST_ActivateWindowDrawingContext(tmpwin->ghostwin);
+                       GWN_context_active_set(tmpwin->gwnctx);
+                       immActivate();
+               }
+
                /* if temp screen, delete it after window free (it stops jobs 
that can access it) */
                if (screen && screen->temp) {
                        Main *bmain = CTX_data_main(C);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to