[Interest] QObject connect/disconnect bug?

Alexander Dyagilev alervdvcw at gmail.com
Fri Jan 18 08:40:57 CET 2019


Sorry, it's seems there is some "nice" bug in my app...

On 1/18/2019 10:13 AM, Alexander Dyagilev wrote:
> Hello,
>
> I have one object (A) in one thread sometimes connecting to another 
> object (B) in another thread.
>
> Object A connects its slots to B's signals. Once a slot is called, it 
> disconnects it from the appropriate signal.
>
> But, I have a problem now that sometimes the connection seems to 
> disappear nowhere. Looks like a race condition bug, because it's not 
> 100% reproducible and is not reproducible in the debug builds at all. 
> Only in release.
>
> I.e. slot is NOT called when the signal is emitted.
>
> I've added logging to file. I've overridden QObject's connectNotify 
> and disconnectNotify methods. In the log I see that the connectNotify 
> is called for signal (and the appropriate disconnectNotify is never 
> called). In the code where I emit signal I've added the additional 
> check: QObject::isSignalConnected returns 0 for signal. Thus emit does 
> not call the slot. But connectNotify was called and disconnectNotify 
> was NOT. Which means the connection must exist!
>
> Any help? What is going on?
>
> Qt 5.11.3, Windows 10, Visual C++ 2015.
>



More information about the Interest mailing list