Details
-
Bug
-
Resolution: Done
-
P4: Low
-
4.7.1
-
None
-
44a4281238a649f359d7e375de9bb1b8c19ed561
Description
I'm talking about this example: http://doc.qt.nokia.com/4.7/tools-undoframework.html
DiagramItems once created in AddCommand's will not be deleted, if their AddCommand is deleted. This can cause to memory leak: if item is not in scene and does not belong to any existing command, it is memory leak.
Easy solution is to use this destructor:
AddCommand::~AddCommand()
}
But this is not universal solution: if set undoLimit of undo stack to something higher than zero, it will glick (it can delete item used by some DeleteCommand, causing to segfault on redo). But in scope of this specific example this solution is ok.