Problem with Qt::QueuedConnection, signal delivered after disconnect
- by lutku
Hi,
I just discovered interesting behavior of queued connection in Qt 4.6:
First queued connection is made:
connect(someSender, SIGNAL(completed()), this, SLOT(handleCompletion()), Qt::QueuedConnection)
Then someSender sends the signal:
emit completed()
Before receiving signal (as it is in queue), I disconnect from the signal:
disconnect(someSender, SIGNAL(completed()), this, SLOT(handleCompletion())
Still, handleCompletion slot is invoked at next eventloop iteration. I can prevent this from happening by using someSender-blockSignals(true) at correct point, but it feels awful not to mention having some boolean flag to disable slot's functionality.
Especially, I feel amazed that this behavior is not mentioned in Qt documentation (at least I haven't found).
Finally the question: any sensible way to avoid this from happening?