Please nominate your Qt Champions for 2021!

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)

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

  • 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?

Log in to reply