Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2013-05-06 15:23:13 +0400
committerTon Roosendaal <ton@blender.org>2013-05-06 15:23:13 +0400
commitb299b039f7d0f0baa65242f918066cdc808a71ce (patch)
tree0b3d81c70feac208a9bbae200e6bbe8107692850 /source
parentc36365935c5146b56753bd997f0a873fc2589b15 (diff)
Bug fix #35179
Added provision for saved corrupt blend files - caused by a startup.blend addressing > 16 GB space, which was read in 32 bits. Now an invalid screen will get removed immediate after read. Might give a memory-not-in-memlist print, but that's quite safe.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 78fcc22ea66..4062f57d4eb 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6148,11 +6148,12 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
v3d->twtype = V3D_MANIP_TRANSLATE;
}
-static void direct_link_screen(FileData *fd, bScreen *sc)
+static bool direct_link_screen(FileData *fd, bScreen *sc)
{
ScrArea *sa;
ScrVert *sv;
ScrEdge *se;
+ bool wrong_id = false;
link_list(fd, &(sc->vertbase));
link_list(fd, &(sc->edgebase));
@@ -6174,8 +6175,8 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
}
if (se->v1 == NULL) {
- printf("error reading screen... file corrupt\n");
- se->v1 = se->v2;
+ printf("Error reading Screen %s... removing it.\n", sc->id.name+2);
+ wrong_id = true;
}
}
@@ -6409,6 +6410,8 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
sa->v3 = newdataadr(fd, sa->v3);
sa->v4 = newdataadr(fd, sa->v4);
}
+
+ return wrong_id;
}
/* ********** READ LIBRARY *************** */
@@ -7016,6 +7019,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
ID *id;
ListBase *lb;
const char *allocname;
+ bool wrong_id;
/* read libblock */
id = read_struct(fd, bhead, "lib block");
@@ -7063,7 +7067,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
direct_link_windowmanager(fd, (wmWindowManager *)id);
break;
case ID_SCR:
- direct_link_screen(fd, (bScreen *)id);
+ wrong_id = direct_link_screen(fd, (bScreen *)id);
break;
case ID_SCE:
direct_link_scene(fd, (Scene *)id);
@@ -7160,6 +7164,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
oldnewmap_free_unused(fd->datamap);
oldnewmap_clear(fd->datamap);
+ if (wrong_id) {
+ BKE_libblock_free(lb, id);
+ }
+
return (bhead);
}