[Qt-interest] Is it sensible to call "delete this; " at the end of a QThread's run method?

Thiago Macieira thiago at kde.org
Mon May 30 08:58:00 CEST 2011


On Sunday, 29 de May de 2011 21:28:33 K. Frank wrote:
> I take it you're saying that "delete this" (within run()) is wrong and
> potentially
> dangerous, irrespective of the thread-affinity issue.  Is this right?

Yes. It's very wrong. Like you guessed yourself, the function that called 
run() does some clean up before actually exiting the thread.

And moveToThread(this) is also very wrong ("you're doing it wrong").

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110530/acad1c00/attachment.bin 


More information about the Qt-interest-old mailing list