summaryrefslogtreecommitdiffstats
path: root/examples/tools/undoframework/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tools/undoframework/commands.cpp')
-rw-r--r--examples/tools/undoframework/commands.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/tools/undoframework/commands.cpp b/examples/tools/undoframework/commands.cpp
index 9e81c3e..ff7b0b7 100644
--- a/examples/tools/undoframework/commands.cpp
+++ b/examples/tools/undoframework/commands.cpp
@@ -136,6 +136,12 @@ AddCommand::AddCommand(DiagramItem::DiagramType addType,
}
//! [7]
+AddCommand::~AddCommand()
+{
+ if (!myDiagramItem->scene())
+ delete myDiagramItem;
+}
+
//! [8]
void AddCommand::undo()
{