Fix #22816: crash in depsgraph loading some 2.49 files, tagging objects for

update on load should be done later because it's not known yet which scene
is used with which layers visible before the windows are created.
This commit is contained in:
Brecht Van Lommel
2010-07-14 09:46:26 +00:00
parent a305a72939
commit 7ad8e5b6f8
3 changed files with 9 additions and 4 deletions

View File

@@ -313,8 +313,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
/* baseflags, groups, make depsgraph, etc */
set_scene_bg(CTX_data_scene(C));
DAG_on_load_update();
MEM_freeN(bfd);
}
@@ -478,6 +476,9 @@ static int read_undosave(bContext *C, UndoElem *uel)
strcpy(G.sce, scestr);
G.fileflags= fileflags;
if(success)
DAG_on_load_update();
return success;
}

View File

@@ -2217,7 +2217,7 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
*sce= bmain->scene.first;
if(*sce) *lay= (*sce)->lay;
/* XXX for background mode, we should get the scen
/* XXX for background mode, we should get the scene
from somewhere, for the -S option, but it's in
the context, how to get it here? */
}
@@ -2248,7 +2248,7 @@ void DAG_on_load_update(void)
dag_current_scene_layers(bmain, &scene, &lay);
if(scene) {
if(scene && scene->theDag) {
/* derivedmeshes and displists are not saved to file so need to be
remade, tag them so they get remade in the scene update loop,
note armature poses or object matrices are preserved and do not

View File

@@ -61,6 +61,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_exotic.h"
#include "BKE_font.h"
@@ -309,7 +310,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
// refresh_interface_font();
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
ED_editors_init(C);
DAG_on_load_update();
#ifndef DISABLE_PYTHON
/* run any texts that were loaded in and flagged as modules */
@@ -389,6 +392,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
BKE_write_undo(C, "original"); /* save current state */
ED_editors_init(C);
DAG_on_load_update();
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */