[Qt-interest] Bug? sender() is always NULL when receiver lives in different QThread from emitter

Thiago Macieira thiago.macieira at trolltech.com
Tue Jul 7 12:31:09 CEST 2009


Florian Vichot wrote:
>Tom Panning a écrit :
>> This seems to be intentional, since Qt's documentation specifically
>> describes this behavior. See the second warning at:
>> http://doc.qtsoftware.com/4.5/qobject.html#sender
>
>Ah darn, that's new. I just checked, that warning did not appear in Qt
>4.4. But still I should have RTFM, thanks for pointing me to such a
>definite answer :)

The warning wasn't there in 4.4 because we had to change the behaviour in 
4.5.

That's the only way to make the behaviour deterministic with threads. 
Otherwise, if another thread is emitting signals, you may get invalid 
pointers. What's more, when a queued connection signal is delivered, the 
parent may already have been deleted.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090707/1a0fb6c0/attachment.bin 


More information about the Qt-interest-old mailing list