04-22-2013 12:05 AM
Just wondering what the best practices are for cleaning up allocated resources in C++ cascades apps. Currently I've got some objects that are children of Cascades objects, and when I try to delete allocated objects in their destructors, I get a lovely SIGSEGV when I close my app.
If I don't clean these up, I get a bunch of spam about not unrealizing my resources.
Are there any guides the community would recommend?
04-22-2013 04:28 AM
Any objects that use the Qt framework (including any Cascades items) are automatically deallocated once the that class's destructor is called. Keep in mind however that you should always set a parent for any cascades or Qt components you create in C++, as any orphaned classes will not be automatically swept up. Alternatively, you can explicitly deallocate a cascades object by using the deleteLater() method.
This does not apply to any classes which do not use the Q_OBJECT macro, you'll need to explicitly delete these. See the Object Ownership in QML & C++ sections of this document.