Details
-
Suggestion
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
5.5.1
-
None
Description
In Gpg4win we have a Windows Explorer Plugin (GpgEX) that synchronously called a Qt Application (Kleopatra) to bring up a Dialog.
For proper Window hierarchy handling that application set's the Windows Explorer as a transientParent. To do this it first calls QWindow::fromWinId(mainWindowId);
This resulted in a Deadlock because QtWindowsWindow uses synchronous SendMessage calls to the window. e.g. in setWindowIcon but while GpgEX waited for Kleopatra to show the Dialog the Windows Explorer never got around to handle Window Messages and thus the SendMessage call never returned.
SendNotifyMessage would be a better choice for calls where the result is not immediately needed.
setWindowIcon was apparently not the only place, after I've patched it there it still deadlocked later on so I've just changed my Explorer plugin to be async and that worked around the issue for me.
But as a suggestion: Avoid SendMessage where you can and please use the async variant instead. Could save developers quite some headaches
To fix this issue I think some developer should go and look at each SendMessage call and ask "Why does this need to be synchronous?"
The setWindowIcon surely does not need to be sync.
Thanks and Regards,
Andre