Fix (unreported) crash when opening a file from splash screen when 'load UI' option is disabled.

See rB935e241fa6ea095493 for details of the issue, but first fix caused regression T47632.

So for now handling the issue in a localized way, this is not a real solution (since this could happen
in other cases), but will do for 2.77.

This commit is to be backported to 2.77.
This commit is contained in:
Bastien Montagne 2016-03-01 12:40:04 +01:00
parent 607d916f50
commit a0db3c3966
1 changed files with 7 additions and 0 deletions

View File

@ -161,6 +161,13 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
/* reset active window */
CTX_wm_window_set(C, active_win);
/* XXX Hack! We have to clear context menu here, because removing all modalhandlers above frees the active menu
* (at least, in the 'startup splash' case), causing use-after-free error in later handling of the button
* callbacks in UI code (see ui_apply_but_funcs_after()).
* Tried solving this by always NULL-ing context's menu when setting wm/win/etc., but it broke popups refreshing
* (see T47632), so for now just handling this specific case here. */
CTX_wm_menu_set(C, NULL);
ED_editors_exit(C);
/* just had return; here from r12991, this code could just get removed?*/