Refactor: Simplify ID Property freeing
This also makes `IDP_CopyProperty` the "opposite" of `IDP_FreeProperty`, which is what I'd expect. Two refactoring steps: * rename IDP_FreeProperty to IDP_FreePropertyContent * new IDP_FreeProperty function that actually frees the property Reviewers: brecht Differential Revision: https://developer.blender.org/D4872
This commit is contained in:
@@ -601,7 +601,6 @@ static IDProperty *idp_from_PyMapping(const char *name, PyObject *ob)
|
||||
pval = PySequence_GetItem(vals, i);
|
||||
if (BPy_IDProperty_Map_ValidateAndCreate(key, prop, pval) == false) {
|
||||
IDP_FreeProperty(prop);
|
||||
MEM_freeN(prop);
|
||||
Py_XDECREF(keys);
|
||||
Py_XDECREF(vals);
|
||||
Py_XDECREF(key);
|
||||
@@ -690,7 +689,7 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
|
||||
prop->prev = prop_exist->prev;
|
||||
prop->next = prop_exist->next;
|
||||
|
||||
IDP_FreeProperty(prop_exist);
|
||||
IDP_FreePropertyContent(prop_exist);
|
||||
*prop_exist = *prop;
|
||||
MEM_freeN(prop);
|
||||
}
|
||||
|
@@ -1122,7 +1122,6 @@ static void pyrna_struct_dealloc(BPy_StructRNA *self)
|
||||
#ifdef PYRNA_FREE_SUPPORT
|
||||
if (self->freeptr && self->ptr.data) {
|
||||
IDP_FreeProperty(self->ptr.data);
|
||||
MEM_freeN(self->ptr.data);
|
||||
self->ptr.data = NULL;
|
||||
}
|
||||
#endif /* PYRNA_FREE_SUPPORT */
|
||||
|
Reference in New Issue
Block a user