Fix: GPv3: Crash on loading file with layer parents

The issue was that the `grease_pencil_foreach_id` did not walk
the parent object pointers which meant they were pointing
to garbage memory.

The fix makes sure to walk all the parent pointers.
This commit is contained in:
Falk David
2024-09-24 11:22:40 +02:00
parent 6d8e3959b0
commit 5eeb5cd164

View File

@@ -178,6 +178,11 @@ static void grease_pencil_foreach_id(ID *id, LibraryForeachIDData *data)
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, drawing_reference->id_reference, IDWALK_CB_USER);
}
}
for (const blender::bke::greasepencil::Layer *layer : grease_pencil->layers()) {
if (layer->parent) {
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, layer->parent, IDWALK_CB_USER);
}
}
}
static void grease_pencil_blend_write(BlendWriter *writer, ID *id, const void *id_address)