Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86596

Event loop hangs indefinitely in DefWindowProc() when invoking slots with BlockingQueuedConnection

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.15.1
    • Core: Event loop
    • None
    • Windows

    Description

      I'm successfully embedding a powerful Qt-based image processing application in a larger .NET Core WPF application. Generally everything works very nicely together, thanks for all this awesome work!

      Recently we switched to using `BlockingQueuedConnection` for `QMetaObject::invokeMethod()` in order to better synchronize the apps and have return values from slots. Ever since, there are sporadic hangs of the whole application.

      I could trace this down and think I understand whats going on. But I fail to see how to resolve it.

      The main Qt event loop hangs in `qwindowscontext.cpp` calling `DefWindowProc()` with a mouse cursor related message. At the same time, the main .NET thread blocks in `qmetaobject.cpp` in `QMetaMethod::invoke()` with `semaphore.acquire()`.

      I assume when calling slots with `BlockingQueuedConnection`, then Qt can not at the same time send unused Windows messages back to the main window. Is that possible?

      Is there a solution to resolve this? I'm under the impression that I do not need all possible messages in the first place. But could I pre-filter on the WPF side to avoid Qt calling `DefWindowProc()` alltogether? Currently the messages are passed automatically, I did not install any message passing or filtering.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            emmenlau Mario Emmenlauer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes