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
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-08-12 18:02:44 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-12 18:03:49 +0400
commitca5c02fc930bce444881269a7bb3eba1fb7a8ed0 (patch)
treee75beaa1ab640b7736a396262e14b4635f9564f3 /source/blender/blenloader/intern
parent0bcc8d5cd3768759859a0af23f5bf2e91b7badfe (diff)
Fix T41411: Undo crashing with background images set.
Since 3DViews use IDs like images or clips, we can't skip anymore `lib_link_screen()` when reading from mem for undo/redo stuff. Else, freeing (unused) screen in `BKE_read_file_from_memfile()` will lead to using data already freed (since pointers have not been updated when reading that undo step).
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/readfile.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7b2aaade713..b04cb16bae7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5960,8 +5960,12 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
v3d->ob_centre = restore_pointer_by_name(newmain, (ID *)v3d->ob_centre, USER_ONE);
for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
- bgpic->ima = restore_pointer_by_name(newmain, (ID *)bgpic->ima, USER_ONE);
- bgpic->clip = restore_pointer_by_name(newmain, (ID *)bgpic->clip, USER_ONE);
+ if ((bgpic->ima = restore_pointer_by_name(newmain, (ID *)bgpic->ima, USER_IGNORE))) {
+ id_us_plus((ID *)bgpic->ima);
+ }
+ if ((bgpic->clip = restore_pointer_by_name(newmain, (ID *)bgpic->clip, USER_IGNORE))) {
+ id_us_plus((ID *)bgpic->clip);
+ }
}
if (v3d->localvd) {
/*Base *base;*/
@@ -7540,8 +7544,9 @@ static void lib_link_all(FileData *fd, Main *main)
/* No load UI for undo memfiles */
if (fd->memfile == NULL) {
lib_link_windowmanager(fd, main);
- lib_link_screen(fd, main);
}
+ /* DO NOT skip screens here, 3Dview may contains pointers to other ID data (like bgpic)! See T41411. */
+ lib_link_screen(fd, main);
lib_link_scene(fd, main);
lib_link_object(fd, main);
lib_link_curve(fd, main);