On Saturday, March 26, 2011 01:34:19 PM Ville M. Vainio wrote: > On Sat, Mar 26, 2011 at 3:20 PM, Patrick Ohly <[email protected]> wrote: > > To give just one example, who is the owner of a QSparqlResult? This > > example here has an explicit delete: > > http://maemo.gitorious.org/maemo-af/qsparql/blobs/master/examples/sparql/ > > asynctracker/main.cpp > > > > This one doesn't: > > http://maemo.gitorious.org/maemo-af/qsparql/blobs/master/examples/sparql/ > > simple/main.cpp > > > > These questions (and memory leak?) could be avoided if QSparqlResult > > wasn't a plain pointer. > > Without taking a stance on how modern this approach is, it's something > that's familiar to Qt developers from > > http://doc.qt.nokia.com/4.7-snapshot/qnetworkaccessmanager.html#get QSparqlResult is a QObject, and its QObject parent is the QSparqlConnection that created it. You can either delete a QSparqlResult yourself, or you can leave it to the QSparqlConnection to delete the results it owns, from its destructor. If a QSparqlResult is still active when an owner QSparqlConnection is deleted you will get a warning message.
That is exactly the same as the example given above where a QNetworkAccessManager owns QNetworkReplies and deletes them in its destructor. -- Richard _______________________________________________ MeeGo-dev mailing list [email protected] http://lists.meego.com/listinfo/meego-dev http://wiki.meego.com/Mailing_list_guidelines
