Fix #36852: duplicate window crash on OS X, another case where it could crash
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 30 Sep 2013 22:07:14 +0000 (22:07 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 30 Sep 2013 22:07:14 +0000 (22:07 +0000)
when changing the window state raises an event, and the window isn't fully
initialized yet.

source/blender/windowmanager/intern/wm_window.c

index 78a2ed9b05d27718387d690f8681bb0d9adbc2be..84ffd7ae3a58a8029677934a170959c1682ae930 100644 (file)
@@ -378,12 +378,12 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
                win->ghostwin = ghostwin;
                GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
                
-               /* set the state*/
-               GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
-
                if (win->eventstate == NULL)
                        win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
                
+               /* set the state */
+               GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
+
                /* until screens get drawn, make it nice gray */
                glClearColor(0.55, 0.55, 0.55, 0.0);
                /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */