From db5120603f8f6236d1417199f257e35e0eb8c00b Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 16 May 2019 14:11:11 +0200 Subject: 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 --- source/blender/blenkernel/BKE_idprop.h | 1 + source/blender/blenkernel/intern/action.c | 2 -- source/blender/blenkernel/intern/addon.c | 1 - source/blender/blenkernel/intern/armature.c | 2 -- source/blender/blenkernel/intern/blender.c | 2 -- .../blender/blenkernel/intern/blender_user_menu.c | 1 - source/blender/blenkernel/intern/constraint.c | 1 - source/blender/blenkernel/intern/fmodifier.c | 1 - source/blender/blenkernel/intern/idprop.c | 31 +++++++++------------- source/blender/blenkernel/intern/layer.c | 1 - source/blender/blenkernel/intern/node.c | 1 - source/blender/blenkernel/intern/object.c | 3 +-- source/blender/blenkernel/intern/scene.c | 1 - source/blender/blenkernel/intern/screen.c | 1 - source/blender/blenkernel/intern/workspace.c | 1 - source/blender/blenkernel/intern/writeffmpeg.c | 4 +-- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/blenloader/intern/versioning_280.c | 2 -- .../blenloader/intern/versioning_defaults.c | 1 - .../depsgraph/intern/depsgraph_query_iter.cc | 1 - source/blender/editors/armature/armature_utils.c | 3 --- source/blender/editors/armature/pose_lib.c | 1 - source/blender/editors/armature/pose_transform.c | 1 - source/blender/editors/armature/pose_utils.c | 1 - source/blender/editors/interface/interface.c | 3 --- .../editors/interface/interface_context_menu.c | 1 - .../blender/editors/interface/interface_layout.c | 1 - source/blender/imbuf/intern/metadata.c | 1 - source/blender/makesrna/intern/rna_access.c | 10 +++---- source/blender/python/generic/idprop_py_api.c | 3 +-- source/blender/python/intern/bpy_rna.c | 1 - .../blender/windowmanager/gizmo/intern/wm_gizmo.c | 1 - source/blender/windowmanager/intern/wm.c | 1 - .../blender/windowmanager/intern/wm_event_system.c | 2 -- source/blender/windowmanager/intern/wm_keymap.c | 4 --- .../windowmanager/intern/wm_operator_type.c | 3 --- source/blender/windowmanager/intern/wm_operators.c | 1 - 37 files changed, 23 insertions(+), 75 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index e6f3d7b4a99..0e54cbc76fc 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -135,6 +135,7 @@ struct IDProperty *IDP_New(const char type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void IDP_FreeProperty_ex(struct IDProperty *prop, const bool do_id_user); +void IDP_FreePropertyContent(struct IDProperty *prop); void IDP_FreeProperty(struct IDProperty *prop); void IDP_ClearProperty(IDProperty *prop); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 34c50865073..65b837048cb 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -822,7 +822,6 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user) if (pchan->prop) { IDP_FreeProperty(pchan->prop); - MEM_freeN(pchan->prop); } /* Cached data, for new draw manager rendering code. */ @@ -964,7 +963,6 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f if (pchan->prop) { /* unlikely but possible it exists */ IDP_FreeProperty(pchan->prop); - MEM_freeN(pchan->prop); pchan->prop = NULL; } if (pchan_from->prop) { diff --git a/source/blender/blenkernel/intern/addon.c b/source/blender/blenkernel/intern/addon.c index 486da61fe68..99ef38722f5 100644 --- a/source/blender/blenkernel/intern/addon.c +++ b/source/blender/blenkernel/intern/addon.c @@ -81,7 +81,6 @@ void BKE_addon_free(bAddon *addon) { if (addon->prop) { IDP_FreeProperty(addon->prop); - MEM_freeN(addon->prop); } MEM_freeN(addon); } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index bd9907acb24..df22aa1dcfb 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -112,7 +112,6 @@ void BKE_armature_bonelist_free(ListBase *lb) for (bone = lb->first; bone; bone = bone->next) { if (bone->prop) { IDP_FreeProperty(bone->prop); - MEM_freeN(bone->prop); } BKE_armature_bonelist_free(&bone->childbase); } @@ -2430,7 +2429,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected } if (prop_orig) { IDP_FreeProperty(prop_orig); - MEM_freeN(prop_orig); } } } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 48b271cf277..9fd3c24092c 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -155,7 +155,6 @@ static void keymap_item_free(wmKeyMapItem *kmi) { if (kmi->properties) { IDP_FreeProperty(kmi->properties); - MEM_freeN(kmi->properties); } if (kmi->ptr) { MEM_freeN(kmi->ptr); @@ -212,7 +211,6 @@ static void userdef_free_keyconfig_prefs(UserDef *userdef) kpt = kpt_next) { kpt_next = kpt->next; IDP_FreeProperty(kpt->prop); - MEM_freeN(kpt->prop); MEM_freeN(kpt); } BLI_listbase_clear(&userdef->user_keyconfig_prefs); diff --git a/source/blender/blenkernel/intern/blender_user_menu.c b/source/blender/blenkernel/intern/blender_user_menu.c index 911f3fdc7b2..ad34ef03e04 100644 --- a/source/blender/blenkernel/intern/blender_user_menu.c +++ b/source/blender/blenkernel/intern/blender_user_menu.c @@ -97,7 +97,6 @@ void BKE_blender_user_menu_item_free(bUserMenuItem *umi) bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi; if (umi_op->prop) { IDP_FreeProperty(umi_op->prop); - MEM_freeN(umi_op->prop); } } MEM_freeN(umi); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c680e15763d..04789adea2f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2113,7 +2113,6 @@ static void pycon_free(bConstraint *con) /* id-properties */ IDP_FreeProperty(data->prop); - MEM_freeN(data->prop); /* multiple targets */ BLI_freelistN(&data->targets); diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index c6188642e41..794d07203af 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -867,7 +867,6 @@ static void fcm_python_free(FModifier *fcm) /* id-properties */ IDP_FreeProperty(data->prop); - MEM_freeN(data->prop); } static void fcm_python_new_data(void *mdata) diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 39e72d7e3a8..c62b7454e67 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -142,7 +142,7 @@ void IDP_SetIndexArray(IDProperty *prop, int index, IDProperty *item) old = GETPROP(prop, index); if (item != old) { - IDP_FreeProperty(old); + IDP_FreePropertyContent(old); memcpy(old, item, sizeof(IDProperty)); } @@ -175,7 +175,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen) int i; for (i = newlen; i < prop->len; i++) { - IDP_FreeProperty(GETPROP(prop, i)); + IDP_FreePropertyContent(GETPROP(prop, i)); } prop->len = newlen; @@ -192,7 +192,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen) /* newlen is smaller */ int i; for (i = newlen; i < prop->len; i++) { - IDP_FreeProperty(GETPROP(prop, i)); + IDP_FreePropertyContent(GETPROP(prop, i)); } } @@ -236,7 +236,6 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr) for (a = newlen; a < prop->len; a++) { IDP_FreeProperty(array[a]); - MEM_freeN(array[a]); } } } @@ -513,7 +512,6 @@ void IDP_SyncGroupValues(IDProperty *dest, const IDProperty *src) default: { BLI_insertlinkreplace(&dest->data.group, other, IDP_CopyProperty(prop)); IDP_FreeProperty(other); - MEM_freeN(other); break; } } @@ -535,7 +533,6 @@ void IDP_SyncGroupTypes(IDProperty *dst, const IDProperty *src, const bool do_ar (prop_src->len != prop_dst->len))) { BLI_insertlinkreplace(&dst->data.group, prop_dst, IDP_CopyProperty(prop_src)); IDP_FreeProperty(prop_dst); - MEM_freeN(prop_dst); } else if (prop_dst->type == IDP_GROUP) { IDP_SyncGroupTypes(prop_dst, prop_src, do_arraylen); @@ -562,7 +559,6 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, const IDProperty *src) if (STREQ(loop->name, prop->name)) { BLI_insertlinkreplace(&dest->data.group, loop, IDP_CopyProperty(prop)); IDP_FreeProperty(loop); - MEM_freeN(loop); break; } } @@ -588,7 +584,6 @@ void IDP_ReplaceInGroup_ex(IDProperty *group, IDProperty *prop, IDProperty *prop if (prop_exist != NULL) { BLI_insertlinkreplace(&group->data.group, prop_exist, prop); IDP_FreeProperty(prop_exist); - MEM_freeN(prop_exist); } else { group->len++; @@ -668,12 +663,6 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw * (the function that adds new properties to groups, #IDP_AddToGroup, * returns false if a property can't be added to the group, and true if it can) * and free the property. - * - * Currently the code to free ID properties is designed to leave the actual struct - * you pass it un-freed, this is needed for how the system works. This means - * to free an ID property, you first call #IDP_FreeProperty then #MEM_freeN the struct. - * In the future this will just be #IDP_FreeProperty and the code will - * be reorganized to work properly. */ bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) { @@ -709,8 +698,7 @@ bool IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew * \note this does not free the property!! * * To free the property, you have to do: - * IDP_FreeProperty(prop); //free all subdata - * MEM_freeN(prop); //free property struct itself + * IDP_FreeProperty(prop); */ void IDP_RemoveFromGroup(IDProperty *group, IDProperty *prop) { @@ -727,7 +715,6 @@ void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) { IDP_RemoveFromGroup(group, prop); IDP_FreeProperty(prop); - MEM_freeN(prop); } IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name) @@ -1093,14 +1080,20 @@ void IDP_FreeProperty_ex(IDProperty *prop, const bool do_id_user) } } -void IDP_FreeProperty(IDProperty *prop) +void IDP_FreePropertyContent(IDProperty *prop) { IDP_FreeProperty_ex(prop, true); } +void IDP_FreeProperty(IDProperty *prop) +{ + IDP_FreePropertyContent(prop); + MEM_freeN(prop); +} + void IDP_ClearProperty(IDProperty *prop) { - IDP_FreeProperty(prop); + IDP_FreePropertyContent(prop); prop->data.pointer = NULL; prop->len = prop->totallen = 0; } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 99e6c99ec0c..60c00160e6d 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -235,7 +235,6 @@ void BKE_view_layer_free_ex(ViewLayer *view_layer, const bool do_id_user) if (view_layer->id_properties) { IDP_FreeProperty(view_layer->id_properties); - MEM_freeN(view_layer->id_properties); } MEM_SAFE_FREE(view_layer->object_bases_array); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 3adb6cfe960..52828205b2d 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1910,7 +1910,6 @@ static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *so { if (sock->prop) { IDP_FreeProperty(sock->prop); - MEM_freeN(sock->prop); } if (sock->default_value) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6c2bd5e6127..78f2b10305e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1951,7 +1951,6 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob) /* copy IDProperties */ if (ob->id.properties) { IDP_FreeProperty(ob->id.properties); - MEM_freeN(ob->id.properties); ob->id.properties = NULL; } if (target->id.properties) { @@ -4497,4 +4496,4 @@ void BKE_object_update_select_id(struct Main *bmain) ob->runtime.select_id = select_id++; ob = ob->id.next; } -} \ No newline at end of file +} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index a1e6aa6c4d6..872f99ff813 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -497,7 +497,6 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user) } if (sce->r.ffcodecdata.properties) { IDP_FreeProperty(sce->r.ffcodecdata.properties); - MEM_freeN(sce->r.ffcodecdata.properties); sce->r.ffcodecdata.properties = NULL; } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 5c41048be83..bc9ec6b28e6 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -427,7 +427,6 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar) } if (uilst->properties) { IDP_FreeProperty(uilst->properties); - MEM_freeN(uilst->properties); } } diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 669eb5c42dc..387d4ec5773 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -356,7 +356,6 @@ void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tre } if (tref->properties) { IDP_FreeProperty(tref->properties); - MEM_freeN(tref->properties); } BLI_remlink(&workspace->tools, tref); MEM_freeN(tref); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index a74d5b241ed..ae41b8f3272 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1616,7 +1616,7 @@ static void ffmpeg_set_expert_options(RenderData *rd) int codec_id = rd->ffcodecdata.codec; if (rd->ffcodecdata.properties) { - IDP_FreeProperty(rd->ffcodecdata.properties); + IDP_FreePropertyContent(rd->ffcodecdata.properties); } if (codec_id == AV_CODEC_ID_H264) { @@ -1680,7 +1680,7 @@ void BKE_ffmpeg_preset_set(RenderData *rd, int preset) int isntsc = (rd->frs_sec != 25); if (rd->ffcodecdata.properties) { - IDP_FreeProperty(rd->ffcodecdata.properties); + IDP_FreePropertyContent(rd->ffcodecdata.properties); } switch (preset) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 51f7ce3adcd..15749cf5d9b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2537,7 +2537,7 @@ static void _IDP_DirectLinkGroup_OrFree(IDProperty **prop, /* corrupt file! */ printf("%s: found non group data, freeing type %d!\n", caller_func_id, (*prop)->type); /* don't risk id, data's likely corrupt. */ - // IDP_FreeProperty(*prop); + // IDP_FreePropertyContent(*prop); *prop = NULL; } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index d8f133c7465..9ddfce95324 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -850,7 +850,6 @@ void do_versions_after_linking_280(Main *bmain) for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { if (srl->prop) { IDP_FreeProperty(srl->prop); - MEM_freeN(srl->prop); } BKE_freestyle_config_free(&srl->freestyleConfig, true); } @@ -1739,7 +1738,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) /* Cleanup. */ IDP_FreeProperty(scene->layer_properties); - MEM_freeN(scene->layer_properties); scene->layer_properties = NULL; #undef EEVEE_GET_FLOAT_ARRAY diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 2d6f0015634..61623a0cade 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -79,7 +79,6 @@ void BLO_update_defaults_userpref_blend(void) if (addon->prop) { IDP_FreeProperty(addon->prop); - MEM_freeN(addon->prop); addon->prop = NULL; } } diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 4bc2ab557ec..06632d7e510 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -94,7 +94,6 @@ void verify_id_properties_freed(DEGObjectIterData *data) // Free memory which is owned by temporary storage which is about to // get overwritten. IDP_FreeProperty(temp_dupli_object->id.properties); - MEM_freeN(temp_dupli_object->id.properties); temp_dupli_object->id.properties = NULL; } diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 20dc7b6c826..27076f84c7f 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -127,7 +127,6 @@ void bone_free(bArmature *arm, EditBone *bone) if (bone->prop) { IDP_FreeProperty(bone->prop); - MEM_freeN(bone->prop); } /* Clear references from other edit bones. */ @@ -777,7 +776,6 @@ void ED_armature_edit_free(struct bArmature *arm) for (eBone = arm->edbo->first; eBone; eBone = eBone->next) { if (eBone->prop) { IDP_FreeProperty(eBone->prop); - MEM_freeN(eBone->prop); } } @@ -811,7 +809,6 @@ void ED_armature_ebone_listbase_free(ListBase *lb) if (ebone->prop) { IDP_FreeProperty(ebone->prop); - MEM_freeN(ebone->prop); } MEM_freeN(ebone); diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 7b31897766d..4bcfdc700b3 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1018,7 +1018,6 @@ static void poselib_backup_free_data(tPoseLib_PreviewData *pld) /* free custom data */ if (plb->oldprops) { IDP_FreeProperty(plb->oldprops); - MEM_freeN(plb->oldprops); } /* free backup element now */ diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 49b66429515..ed728714c5b 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -1225,7 +1225,6 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->prop) { IDP_FreeProperty(pchan->prop); - MEM_freeN(pchan->prop); } } diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index a1f763ac57d..fbaf2c896d0 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -203,7 +203,6 @@ void poseAnim_mapping_free(ListBase *pfLinks) /* free custom properties */ if (pfl->oldprops) { IDP_FreeProperty(pfl->oldprops); - MEM_freeN(pfl->oldprops); } /* free list of F-Curve reference links */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 340aa389f3f..0e4b07f4b48 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1086,7 +1086,6 @@ static bool ui_but_event_operator_string_from_menu(const bContext *C, } IDP_FreeProperty(prop_menu); - MEM_freeN(prop_menu); return found; } @@ -1135,7 +1134,6 @@ static bool ui_but_event_operator_string_from_panel(const bContext *C, } IDP_FreeProperty(prop_panel); - MEM_freeN(prop_panel); return found; } @@ -1356,7 +1354,6 @@ static bool ui_but_event_property_operator_string(const bContext *C, /* cleanup */ IDP_FreeProperty(prop_path); - MEM_freeN(prop_path); if (data_path) { MEM_freeN(data_path); } diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 0055349d4be..9ef98db49f5 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -116,7 +116,6 @@ static void shortcut_free_operator_property(IDProperty *prop) { if (prop) { IDP_FreeProperty(prop); - MEM_freeN(prop); } } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 37ef0948dee..dc57be4f07f 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1455,7 +1455,6 @@ void uiItemsFullEnumO_items(uiLayout *layout, if (properties) { if (tptr.data) { IDP_FreeProperty(tptr.data); - MEM_freeN(tptr.data); } tptr.data = IDP_CopyProperty(properties); } diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c index ed3b214047a..ac31f7db791 100644 --- a/source/blender/imbuf/intern/metadata.c +++ b/source/blender/imbuf/intern/metadata.c @@ -55,7 +55,6 @@ void IMB_metadata_free(struct IDProperty *metadata) } IDP_FreeProperty(metadata); - MEM_freeN(metadata); } bool IMB_metadata_get_field(struct IDProperty *metadata, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index d5dfd0b5503..a12951d9796 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -302,7 +302,7 @@ static IDProperty *rna_idproperty_ui_ensure(PointerRNA *ptr, PropertyRNA *prop, idprop = IDP_New(IDP_GROUP, &dummy, RNA_IDP_UI); if (!IDP_AddToGroup(props, idprop)) { - IDP_FreeProperty(idprop); + IDP_FreePropertyContent(idprop); return NULL; } } @@ -316,7 +316,7 @@ static IDProperty *rna_idproperty_ui_ensure(PointerRNA *ptr, PropertyRNA *prop, rv = IDP_New(IDP_GROUP, &dummy, name); if (!IDP_AddToGroup(idprop, rv)) { - IDP_FreeProperty(rv); + IDP_FreePropertyContent(rv); return NULL; } } @@ -370,7 +370,7 @@ static bool rna_idproperty_ui_set_default(PointerRNA *ptr, item = IDP_New(type, value, "default"); if (!IDP_AddToGroup(idp_ui, item)) { - IDP_FreeProperty(item); + IDP_FreePropertyContent(item); return false; } } @@ -3961,7 +3961,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA item = IDP_New(IDP_GROUP, &val, ""); IDP_AppendArray(idprop, item); /* IDP_AppendArray does a shallow copy (memcpy), only free memory */ - /* IDP_FreeProperty(item); */ + /* IDP_FreePropertyContent(item); */ MEM_freeN(item); rna_idproperty_touch(idprop); } @@ -3977,7 +3977,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA item = IDP_New(IDP_GROUP, &val, ""); IDP_AppendArray(idprop, item); /* IDP_AppendArray does a shallow copy (memcpy), only free memory */ - /* IDP_FreeProperty(item); */ + /* IDP_FreePropertyContent(item); */ MEM_freeN(item); } } diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index dd5baaa661c..30cad991b55 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -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); } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index a87deeabc65..819dc3ac495 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -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 */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c index e2e5096ef99..b05865aa7bb 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c @@ -754,7 +754,6 @@ void WM_gizmo_properties_free(PointerRNA *ptr) if (properties) { IDP_FreeProperty(properties); - MEM_freeN(properties); ptr->data = NULL; /* just in case */ } } diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 7647e9f558f..77e17ad4687 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -82,7 +82,6 @@ void WM_operator_free(wmOperator *op) if (op->properties) { IDP_FreeProperty(op->properties); - MEM_freeN(op->properties); } if (op->reports && (op->reports->flag & RPT_FREE)) { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 13b6260e2b9..8ad23af446d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1293,7 +1293,6 @@ static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_ IDP_MergeGroup(op->properties, replaceprops, true); IDP_FreeProperty(replaceprops); - MEM_freeN(replaceprops); return changed; } @@ -1316,7 +1315,6 @@ bool WM_operator_last_properties_store(wmOperator *op) { if (op->type->last_properties) { IDP_FreeProperty(op->type->last_properties); - MEM_freeN(op->type->last_properties); op->type->last_properties = NULL; } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 4bcbce028b1..a4ee735d911 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1412,7 +1412,6 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap, } IDP_FreeProperty(properties_default); - MEM_freeN(properties_default); } } } @@ -1586,7 +1585,6 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, } IDP_FreeProperty(properties_temp); - MEM_freeN(properties_temp); } } @@ -1625,7 +1623,6 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, } IDP_FreeProperty(properties_default); - MEM_freeN(properties_default); } } } @@ -2022,7 +2019,6 @@ void WM_keymap_item_restore_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt if (orig->properties) { if (kmi->properties) { IDP_FreeProperty(kmi->properties); - MEM_freeN(kmi->properties); kmi->properties = NULL; } diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index 3585cffc615..179b4402200 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -156,7 +156,6 @@ void WM_operatortype_remove_ptr(wmOperatorType *ot) if (ot->last_properties) { IDP_FreeProperty(ot->last_properties); - MEM_freeN(ot->last_properties); } if (ot->macro.first) { @@ -194,7 +193,6 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot) { if (ot->last_properties) { IDP_FreeProperty(ot->last_properties); - MEM_freeN(ot->last_properties); } if (ot->macro.first) { @@ -279,7 +277,6 @@ void WM_operatortype_last_properties_clear_all(void) if (ot->last_properties) { IDP_FreeProperty(ot->last_properties); - MEM_freeN(ot->last_properties); ot->last_properties = NULL; } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 8445f27ceba..0bb2fd58824 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -691,7 +691,6 @@ void WM_operator_properties_free(PointerRNA *ptr) if (properties) { IDP_FreeProperty(properties); - MEM_freeN(properties); ptr->data = NULL; /* just in case */ } } -- cgit v1.2.3