October 20, 2010

Uwe Kindler Uwe Kindler
Lab Rat
64 posts

QObject::disconnect() on a queued connection

 

If I call disconnect() on a queued SIGNAL/SLOT connection then it may happen, that the target slot of this connection gets called after the disconnect call. This is not explicitely documented in the SIGNAL/SLOT documentation but I think that all SIGNALs that are already in the queue of the queued connection get executed even if the connection is already disconnected.

Is this right or am I wrong here?

If it is right, then it should be documented in the SIGNAL/SLOT documentation or disconnect() documentation because it may cause strange effects if somone expects that calling disconnect() means “my slot function will never get called from now on” (like me :O)

2 replies

October 20, 2010

Andre Andre
Area 51 Engineer
6077 posts

Interesting suggestion. I think you are right, but I am not sure either.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

May 24, 2012

silicomancer silicomancer
Lab Rat
22 posts

Pretty old posting. But I have the same question. Is he right? Doesn’t a disconnect() prevent queued calls from being executed? Does the documentation describe this behaviour somewhere?

 
  ‹‹ QTestLib and signal emission.      [Solved]QToolButton Hover event ››

You must log in to post a reply. Not a member yet? Register here!