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 <bastien@blender.org>2020-05-25 18:39:16 +0300
committerBastien Montagne <bastien@blender.org>2020-05-25 18:44:27 +0300
commit396bf6ca781fdfa79544c92f3d6bdff52c96fedf (patch)
tree68765eecfc5dd9d8d90e9e19d67e9fd037cdadba /source/blender/blenloader/intern/readblenentry.c
parent6d4dc22e17a7b2bb22495602a8f64cd6c00162d3 (diff)
Fix T73164: Undo does not always properly clear no-more-used library data.
Solution is actually very simple, and even makes existing code simpler: just write all lib IDs when storing and undo step. That way we do not have to guess which indirectly used library should be kept or not after an undo step reading.
Diffstat (limited to 'source/blender/blenloader/intern/readblenentry.c')
-rw-r--r--source/blender/blenloader/intern/readblenentry.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index adf7db0267e..1309b3e3c33 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -428,41 +428,6 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
* but oldmain itself shall *never* be 'transferred' to new mainlist! */
BLI_assert(old_mainlist.first == oldmain);
- if (bfd && old_mainlist.first != old_mainlist.last) {
- /* Even though directly used libs have been already moved to new main,
- * indirect ones have not.
- * This is a bit annoying, but we have no choice but to keep them all for now -
- * means some now unused data may remain in memory, but think we'll have to live with it. */
- Main *libmain, *libmain_next;
- Main *newmain = bfd->main;
- ListBase new_mainlist = {newmain, newmain};
-
- for (libmain = oldmain->next; libmain; libmain = libmain_next) {
- libmain_next = libmain->next;
- /* Note that LIB_INDIRECT does not work with libraries themselves, so we use non-NULL
- * parent to detect indirect-linked ones. */
- if (libmain->curlib && (libmain->curlib->parent != NULL)) {
- BLI_remlink(&old_mainlist, libmain);
- BLI_addtail(&new_mainlist, libmain);
- }
- else {
-#ifdef PRINT_DEBUG
- printf("Dropped Main for lib: %s\n", libmain->curlib->id.name);
-#endif
- }
- }
- /* In any case, we need to move all lib data-blocks themselves - those are
- * 'first level data', getting rid of them would imply updating spaces & co
- * to prevent invalid pointers access. */
- BLI_movelisttolist(&newmain->libraries, &oldmain->libraries);
-
- blo_join_main(&new_mainlist);
- }
-
-#if 0
- printf("Remaining mains/libs in oldmain: %d\n", BLI_listbase_count(&fd->old_mainlist) - 1);
-#endif
-
/* That way, libs (aka mains) we did not reuse in new undone/redone state
* will be cleared together with oldmain... */
blo_join_main(&old_mainlist);