How to clear pending signals in the queue?
Solved
General and Desktop
-
Consider the following scenario: an object of class A is created in thread 1 and an object of class B is created in thread 2. Both A and B are QObjects. A connects to a signal emitted by B with QueuedConnection.
Is there a way to stop thread 2, destroy object B and clear all the pending signals from B to prevent the handler in object A from being called after B is destroyed?
There is QCoreApplication::removePostedEvents, but it is not clear how to use it.