Fix: GPv3: Crash when changing the active layer

Caused by 0a64785067.
This commit is contained in:
Falk David
2024-07-23 14:47:59 +02:00
parent 56bd0c7e4a
commit 7d54e428e4

View File

@@ -210,14 +210,14 @@ class LayerViewItem : public AbstractTreeViewItem {
void on_activate(bContext &C) override
{
PointerRNA grease_pencil_ptr = RNA_pointer_create(
PointerRNA layers_ptr = RNA_pointer_create(
&grease_pencil_.id, &RNA_GreasePencilv3Layers, nullptr);
PointerRNA value_ptr = RNA_pointer_create(&grease_pencil_.id, &RNA_GreasePencilLayer, &layer_);
PropertyRNA *prop = RNA_struct_find_property(&grease_pencil_ptr, "active_layer");
PropertyRNA *prop = RNA_struct_find_property(&layers_ptr, "active");
RNA_property_pointer_set(&grease_pencil_ptr, prop, value_ptr, nullptr);
RNA_property_update(&C, &grease_pencil_ptr, prop);
RNA_property_pointer_set(&layers_ptr, prop, value_ptr, nullptr);
RNA_property_update(&C, &layers_ptr, prop);
ED_undo_push(&C, "Active Grease Pencil Layer");
}