diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-02 17:00:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-02 17:00:36 (GMT) |
commit | 4988b6e0a9e43132abb200c7626d6c98f568c61b (patch) | |
tree | 066d72c2a3183aaedb00c80bbc010516399715cd | |
parent | a4bd77aeb5a21a0b29ff3f618a506fd42b2e9517 (diff) | |
parent | fed0493f37b82dd9ebb8a9358d96f19c161afb99 (diff) | |
download | Qt-4988b6e0a9e43132abb200c7626d6c98f568c61b.zip Qt-4988b6e0a9e43132abb200c7626d6c98f568c61b.tar.gz Qt-4988b6e0a9e43132abb200c7626d6c98f568c61b.tar.bz2 |
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team
* '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team:
Doc: Fixed memory leak in undo framework example
-rw-r--r-- | examples/tools/undoframework/commands.cpp | 6 | ||||
-rw-r--r-- | examples/tools/undoframework/commands.h | 1 |
2 files changed, 7 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() { diff --git a/examples/tools/undoframework/commands.h b/examples/tools/undoframework/commands.h index ba27e2d..a4e4ab9 100644 --- a/examples/tools/undoframework/commands.h +++ b/examples/tools/undoframework/commands.h @@ -87,6 +87,7 @@ class AddCommand : public QUndoCommand public: AddCommand(DiagramItem::DiagramType addType, QGraphicsScene *graphicsScene, QUndoCommand *parent = 0); + ~AddCommand(); void undo(); void redo(); |