[Qt-interest] undoframework example memory leaks
Malyushytsky, Alex
alex at wai.com
Thu Feb 25 00:39:49 CET 2010
The way "Undoframework" implements DeleteCommand and AddCommand leads to memory leaks.
I understand that example is not ready to release application,
but it would have much more value,
if it demonstrated the correct way to deal with situations it deals with.
DeleteCommand and AddCommand should delete item from destructor,
if item was not added back to the scene through undo() or redo() .
It might be enough to add the following code in the destructor:
DeleteCommand::~ DeleteCommand (void)
{
if (myDiagramItem && (!myDiagramItem->scene()) )
delete( myDiagramItem);
}
Regards,
Alex Malyushytsky
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list