* ObjectManipulator.cpp (ObjectManipulator::getMenuState): fixed #1676

"Crash when deleting an interface that has multiple IP addresses
and not all addresses are selected for deletion"
This commit is contained in:
Vadim Kurland
2010-08-09 01:20:29 +00:00
parent 3ca271c2d8
commit 1ffc542e81
3 changed files with 22 additions and 1 deletions
+1 -1
View File
@@ -1 +1 @@
#define BUILD_NUM 3218 #define BUILD_NUM 3219
+6
View File
@@ -1,3 +1,9 @@
2010-08-08 Vadim Kurland <vadim@vk.crocodile.org>
* ObjectManipulator.cpp (ObjectManipulator::getMenuState): fixed #1676
"Crash when deleting an interface that has multiple IP addresses
and not all addresses are selected for deletion"
2010-08-06 vadim <vadim@vk.crocodile.org> 2010-08-06 vadim <vadim@vk.crocodile.org>
* ObjectManipulator_tree_ops.cpp (ObjectManipulator::clearObjects): * ObjectManipulator_tree_ops.cpp (ObjectManipulator::clearObjects):
+15
View File
@@ -854,6 +854,11 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
if (getCurrentObjectTree()==NULL) return; if (getCurrentObjectTree()==NULL) return;
// delete, cut and copy menu items will be enabled only if all
// selected objects have the same parent (so user can not select
// an interface and one but not all of its addresses for deletion,
// see #1676)
FWObject *parent = NULL;
vector<FWObject*> so = getCurrentObjectTree()->getSelectedObjects(); vector<FWObject*> so = getCurrentObjectTree()->getSelectedObjects();
for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i) for (vector<FWObject*>::iterator i=so.begin(); i!=so.end(); ++i)
{ {
@@ -867,6 +872,16 @@ void ObjectManipulator::getMenuState(bool haveMoveTargets,
QString object_path = obj->getPath(true).c_str(); QString object_path = obj->getPath(true).c_str();
if (parent == NULL) parent = obj->getParent();
else
{
if (parent != obj->getParent())
{
delMenuItem = false;
copyMenuItem = false;
}
}
copyMenuItem = copyMenuItem && FWBTree().getCopyMenuState(object_path); copyMenuItem = copyMenuItem && FWBTree().getCopyMenuState(object_path);
pasteMenuItem = pasteMenuItem && pasteMenuItem = pasteMenuItem &&
FWBTree().getPasteMenuState(object_path) && FWBTree().getPasteMenuState(object_path) &&