[Interest] moveToThread and object deletion
Thiago Macieira
thiago.macieira at intel.com
Thu Mar 14 18:51:04 CET 2013
On quinta-feira, 14 de março de 2013 18.33.38, Etienne Sandré-Chardonnal
wrote:
> Is it safe and correct to connect QThread::quit() and QThread::terminated()
> to Worker::deleteLater() ? I would say no, as signal/slot mechanism will
> try to run deleteLater() in the workerThread, which is not running anymore,
> so object deletion will never happen.
That's actually very good thinking, showing you understand how threads work.
But we added a little bit of magic to the event dispatcher: after the
finished() signal is emitted, it runs all events once again to process object
deletions. You couldn't have known that by simple analysis.
In other words, you can connect finished() to deleteLater() and it will work.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130314/253183b0/attachment.sig>
More information about the Interest
mailing list