[#20112] User Preferences window causes a crash

Opened preference window caused a crash (context pointing to freed screen) when Load UI was turned off.
This commit is contained in:
Martin Poirier
2010-01-13 21:37:13 +00:00
parent 27dc5be730
commit 9bcfcfb873
2 changed files with 13 additions and 2 deletions

View File

@@ -1125,7 +1125,13 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
screen->winid= 0;
/* before deleting the temp screen or we get invalid access */
CTX_wm_window_set(C, prevwin);
if (prevwin->screen->full != SCREENTEMP) {
/* use previous window if possible */
CTX_wm_window_set(C, prevwin);
} else {
/* none otherwise */
CTX_wm_window_set(C, NULL);
}
/* if temp screen, delete it */
if(screen->full == SCREENTEMP) {

View File

@@ -109,11 +109,13 @@ static void writeBlog(void);
static void wm_window_match_init(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm= G.main->wm.first;
wmWindow *win;
wmWindow *win, *active_win;
*wmlist= G.main->wm;
G.main->wm.first= G.main->wm.last= NULL;
active_win = CTX_wm_window(C);
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for(wm= wmlist->first; wm; wm= wm->id.next) {
@@ -129,6 +131,9 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
}
}
/* reset active window */
CTX_wm_window_set(C, active_win);
ED_editors_exit(C);
return;