Fix T97289: Linked collection assets disappear.

After appending, new link/append code would delete linked IDs, even if
those where pre-existing. Note that this would actually lead to invalid
memory access later in append code (ASAN crash).
This commit is contained in:
Bastien Montagne 2022-04-13 10:25:53 +02:00
parent 4a70561bbd
commit a63982a65b
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #97289, Linked collection assets disappear
1 changed files with 5 additions and 0 deletions

View File

@ -1187,6 +1187,11 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *
BLI_assert(ID_IS_LINKED(id));
BLI_assert(id->newid != NULL);
/* Do NOT delete a linked data that was already linked before this append. */
if (id->tag & LIB_TAG_PRE_EXISTING) {
continue;
}
id->tag |= LIB_TAG_DOIT;
item->new_id = id->newid;
}