diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-23 12:45:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-04-23 12:45:40 +0300 |
commit | fdf5834b444de90507bdc67e979e42fcfecc6bd6 (patch) | |
tree | 2e7432e78d21c67c8f598ad1668f4a9867ce0c9f /source | |
parent | 63c46541356691a38f1cb0fab3fddb2b111c6160 (diff) |
Fix crash reading old userpref.blend
While window manager is supposed to exist after file was fully read
and do-versioned, we can not rely on window manager to exist while
reading file and setting up an environment.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 661b7b53260..09e53bc9eb7 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -654,32 +654,34 @@ void do_versions_after_linking_280(Main *main) /* SpaceTime & SpaceLogic removal/replacing */ if (!MAIN_VERSION_ATLEAST(main, 280, 9)) { const wmWindowManager *wm = main->wm.first; - const Scene *scene = main->scene.first; + if (wm != NULL) { + const Scene *scene = main->scene.first; - /* Action editors need a scene for creation. First, update active - * screens using the active scene of the window they're displayed in. - * Next, update remaining screens using first scene in main listbase. */ + /* Action editors need a scene for creation. First, update active + * screens using the active scene of the window they're displayed in. + * Next, update remaining screens using first scene in main listbase. */ - for (wmWindow *win = wm->windows.first; win; win = win->next) { - const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); - for (ScrArea *area = screen->areabase.first; area; area = area->next) { - if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) { - do_version_area_change_space_to_space_action(area, win->scene); + for (wmWindow *win = wm->windows.first; win; win = win->next) { + const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) { + do_version_area_change_space_to_space_action(area, win->scene); - /* Don't forget to unset! */ - area->butspacetype = SPACE_EMPTY; + /* Don't forget to unset! */ + area->butspacetype = SPACE_EMPTY; + } } } - } - for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) { - for (ScrArea *area = screen->areabase.first; area; area = area->next) { - if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) { - /* Areas that were already handled won't be handled again */ - do_version_area_change_space_to_space_action(area, scene); + for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) { + /* Areas that were already handled won't be handled again */ + do_version_area_change_space_to_space_action(area, scene); - /* Don't forget to unset! */ - area->butspacetype = SPACE_EMPTY; + /* Don't forget to unset! */ + area->butspacetype = SPACE_EMPTY; + } } } } |