From fa774b51c7a85560cc271f41815a193dea9f4cd6 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Thu, 11 Aug 2011 14:14:56 +0300 Subject: [PATCH] Fixed: #1302 Fixed crash program. --- .../src/plugins/world_editor/world_editor_actions.cpp | 2 +- .../src/plugins/world_editor/world_editor_scene.cpp | 9 +++++++++ .../src/plugins/world_editor/world_editor_scene.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp index c6ed1ee3e..440382b15 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp @@ -121,7 +121,7 @@ void removeGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode { QGraphicsItem *item = qvariant_cast(node->data(Constants::GRAPHICS_DATA_QT4_2D)); if (item != 0) - delete item; + scene->removeWorldItem(item); break; } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp index 6fba9f628..7e2ac9c20 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp @@ -80,6 +80,15 @@ QGraphicsItem *WorldEditorScene::addWorldItemZone(const QPolygonF &polygon) return item; } +void WorldEditorScene::removeWorldItem(QGraphicsItem *item) +{ + updateSelectedItems(true); + m_selectedItems.clear(); + m_editedSelectedItems = false; + m_firstSelection = false; + delete item; +} + void WorldEditorScene::setModeEdit(WorldEditorScene::ModeEdit mode) { if (mode == WorldEditorScene::SelectMode) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h index 408ba99b6..aa813c5c5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h @@ -59,6 +59,8 @@ public: QGraphicsItem *addWorldItemPath(const QPolygonF &polyline); QGraphicsItem *addWorldItemZone(const QPolygonF &polygon); + void removeWorldItem(QGraphicsItem *item); + void setModeEdit(WorldEditorScene::ModeEdit mode); WorldEditorScene::ModeEdit editMode() const;