Commit: 16aed16ec01e994a2e563da0b65f8b8cc12e5734
Author: Philipp Oeser
Date:   Tue Apr 5 09:49:55 2022 +0200
Branches: temp-T96710-pbvh-pixels
https://developer.blender.org/rB16aed16ec01e994a2e563da0b65f8b8cc12e5734

Fix T96888: data transfer operator crash in certain situation

The operator could crash in case the context "object" was overridden
from python, but the "active_object" wasnt (and the active object was
not a mesh).

Reason for the crash is a mismatch in the operators poll function
`data_transfer_poll` vs. `dt_layers_select_src_itemf` -- in the former,
the overriden "object" was respected (and if this was a mesh, the poll
was permissive), in the later it wasnt and only the "active_object" was
used (if this was not a mesh, a crash would happen trying to get an
evaluated mesh).

Now rectify how the object which is used is being fetched -> use
`ED_object_active_context` everywhere (see also rBe560bbe1d584).

Maniphest Tasks: T96888

Differential Revision: https://developer.blender.org/D14552

===================================================================

M       source/blender/editors/object/object_data_transfer.c

===================================================================

diff --git a/source/blender/editors/object/object_data_transfer.c 
b/source/blender/editors/object/object_data_transfer.c
index 3447ded5f68..23d2327fe72 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -137,7 +137,7 @@ static const EnumPropertyItem 
*dt_layers_select_src_itemf(bContext *C,
   RNA_enum_items_add_value(
       &item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
 
-  Object *ob_src = CTX_data_active_object(C);
+  Object *ob_src = ED_object_active_context(C);
   if (ob_src == NULL) {
     RNA_enum_item_end(&item, &totitem);
     *r_free = true;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to