Fix crash activating a fullscreened screen
authorJulian Eisel <eiseljulian@gmail.com>
Sat, 4 May 2019 13:12:55 +0000 (15:12 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Sat, 4 May 2019 13:12:55 +0000 (15:12 +0200)
Steps to reproduce were:
* Duplicate some area into new window (shift-click corner triangle)
* Make it fullscreen
* Close the window again
* Activate the added screen from the menu (the one without the
  -nonnormal prefix)
-> Crash (you may have to press "Back to Previous" first though)

When activating a screen, code should check if there's a fullscreen
variant of it and activate that instead. From what I can tell that's
what the code tried to do, but incorrectly.

Same issue as T64045, but things are a bit different for 2.7.

source/blender/editors/screen/screen_edit.c

index f777b42c5bd552d9f878752ca98dd9b3b22cc410..3d2a3e395b9e88a0d4e042f0d926ed963b732f24 100644 (file)
@@ -1195,10 +1195,9 @@ bool ED_screen_set(bContext *C, bScreen *sc)
                return true;
        }
 
-       if (ELEM(sc->state, SCREENMAXIMIZED, SCREENFULL)) {
-               /* find associated full */
-               bScreen *sc1;
-               for (sc1 = bmain->screen.first; sc1; sc1 = sc1->id.next) {
+       /* find associated full */
+       for (bScreen *sc1 = bmain->screen.first; sc1; sc1 = sc1->id.next) {
+               if ((sc1 != sc) && ELEM(sc1->state, SCREENMAXIMIZED, SCREENFULL)) {
                        ScrArea *sa = sc1->areabase.first;
                        if (sa->full == sc) {
                                sc = sc1;