There were some issues in this function. * Undefined behavior for the fallback when getting the `layer_src` * Searching for the layer `grease_pencil_dst` based on the value of a pointer, instead of the `name`. Pull Request: https://projects.blender.org/blender/blender/pulls/122426