From 568e9c99129534d8add4f075de9fcd629738ddeb Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Mon, 28 Mar 2011 17:47:13 -0700 Subject: [PATCH] * ObjectManipulator.cpp (getDeleteMenuState): see #2226 fixed GUI crash that happened when user tried to delete or cut an object from locked library. --- doc/ChangeLog | 4 ++++ src/libgui/ObjectManipulator.cpp | 2 ++ src/libgui/ObjectManipulator_ops.cpp | 2 ++ src/libgui/ObjectManipulator_slots.cpp | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 57a3b2f15..49d35116f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,9 @@ 2011-03-28 vadim + * ObjectManipulator.cpp (getDeleteMenuState): see #2226 fixed GUI + crash that happened when user tried to delete or cut an object + from locked library. + * RuleOptionsDialog.cpp (loadFWObject): see #2230 the GUI should allow limit-burst values of up to 10000 diff --git a/src/libgui/ObjectManipulator.cpp b/src/libgui/ObjectManipulator.cpp index c3df56f22..98b0380a0 100644 --- a/src/libgui/ObjectManipulator.cpp +++ b/src/libgui/ObjectManipulator.cpp @@ -773,6 +773,8 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos) bool ObjectManipulator::getDeleteMenuState(FWObject *obj) { + if (obj->isReadOnly()) return false; + QString objPath = obj->getPath(true).c_str(); bool del_menu_item_state = FWBTree().getDeleteMenuState(objPath); diff --git a/src/libgui/ObjectManipulator_ops.cpp b/src/libgui/ObjectManipulator_ops.cpp index 585dc657b..5eb1ab3a1 100644 --- a/src/libgui/ObjectManipulator_ops.cpp +++ b/src/libgui/ObjectManipulator_ops.cpp @@ -503,6 +503,8 @@ void ObjectManipulator::deleteObject(FWObject *obj, QUndoCommand* macro) if (object_library->getId() == FWObjectDatabase::STANDARD_LIB_ID) return; + if (obj->isReadOnly()) return; + if (obj->getId() == FWObjectDatabase::STANDARD_LIB_ID || obj->getId() == FWObjectDatabase::DELETED_OBJECTS_ID) return; diff --git a/src/libgui/ObjectManipulator_slots.cpp b/src/libgui/ObjectManipulator_slots.cpp index e855836f4..c70047a19 100644 --- a/src/libgui/ObjectManipulator_slots.cpp +++ b/src/libgui/ObjectManipulator_slots.cpp @@ -300,7 +300,7 @@ void ObjectManipulator::delObj(QUndoCommand* macro) if (so2.size()==0) return; - if (so2.size()>1 || !Library::isA(so2.front())) + if (so2.size() > 1 || ! Library::isA(so2.front())) { QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) ); ConfirmDeleteObjectDialog * dlg = new ConfirmDeleteObjectDialog(this);