[Interest] Can a signal/slot connection still exist after the receiver is destroyed?
Alexander Dyagilev
alervdvcw at gmail.com
Fri Jan 5 16:56:03 CET 2024
Hello,
Let's suppose we have an object A with slot AA living in thread AAA.
Let's suppose we have an object B with signal BB living in thread BBB.
Let's suppose we've created a direct signal/slot connection from BB to AA.
Question: is it possible that BB can call AA after it was destroyed? I mean
race condition bug (we have 2 threads). I.e. is connection 100% always
destroyed before A is destroyed?
Well, it seems I just understood. BBB see the connection and starts calling
AA. Then, CPU switch occurs. Thread BBB suspended and AAA resuming. AAA
destroys A. Then BBB resuming and continues to call AA. And we get a crash.
Am I right here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240105/206b0dfe/attachment.htm>
More information about the Interest
mailing list