In my code a worker thread emits a signal.
From Qt Docs:
Qt::BlockingQueuedConnection - Same as QueuedConnection, except the current thread blocks until the slot returns. This connection type should only be used where the emitter and receiver are in different threads. Note: Violating this rule can cause your application to deadlock.
How to determine when emitter and receiver are in different threads. I have some vague ideas about that, because I had problems with my application till I added Qt::BlockingQueuedConnection
flag. But know my application does not want to close. It is stuck with working thread.
UPDATE:
I investigate the problem more. The thread is blocked by emitted signals. Because when I close the application, the slots (in MainWindow) are destroyed, and emit signal produce this deadlock.
How to solve this issue?