From 670e185465e55a7d96d8458fced9156091bd8ae5 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 26 Aug 2014 23:04:01 +0300 Subject: [PATCH] Don't need delete properties in method itemClicked. --HG-- branch : feature --- src/app/widgets/vtooloptionspropertybrowser.cpp | 9 ++------- src/libs/vpropertyexplorer/vpropertyset.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/app/widgets/vtooloptionspropertybrowser.cpp b/src/app/widgets/vtooloptionspropertybrowser.cpp index ac5b3c4f5..d050e37d2 100644 --- a/src/app/widgets/vtooloptionspropertybrowser.cpp +++ b/src/app/widgets/vtooloptionspropertybrowser.cpp @@ -67,17 +67,12 @@ void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item) return; } - QMap::ConstIterator itProp = propertyToId.constBegin(); - while (itProp != propertyToId.constEnd()) - { - delete itProp.key(); - itProp++; - } + PropertyModel->clear(); propertyToId.clear(); idToProperty.clear(); currentItem = item; - PropertyModel->clear(); + if (currentItem == nullptr) { return; diff --git a/src/libs/vpropertyexplorer/vpropertyset.cpp b/src/libs/vpropertyexplorer/vpropertyset.cpp index ca7f0f871..d5554acd9 100644 --- a/src/libs/vpropertyexplorer/vpropertyset.cpp +++ b/src/libs/vpropertyexplorer/vpropertyset.cpp @@ -103,12 +103,12 @@ int VPropertySet::count() const void VPropertySet::clear(bool delete_properties) { d_ptr->Properties.clear(); -// while(!d_ptr->RootProperties.isEmpty()) { -// VProperty* tmpProp = d_ptr->RootProperties.takeLast(); -// if(tmpProp != NULL && delete_properties) { -// delete tmpProp; -// } -// } + while(!d_ptr->RootProperties.isEmpty()) { + VProperty* tmpProp = d_ptr->RootProperties.takeLast(); + if(tmpProp != nullptr && delete_properties) { + delete tmpProp; + } + } } QString VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_id) const