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

Windows QPA doesn't update window owner when QWindow::setTransientParent is called

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.9, 5.10, 5.11
    • None
    • Windows

      How to reproduce:

      • Create windows w1, w2 and w3. Make w1 the transient parent of w2, and w2 the transient parent of w3.
      • Call w3->setTransientParent(w1) and destroy w2
      • Even though we tried to change the transient parent of w3 to w1, w3 will be destroyed by Windows when w2 is destroyed, since, to Windows, w2 is still the owner of w3. A warning like the following will be logged:

      [12408] External WM_DESTROY received for QWindow(0x13827fafcb0) , parent: QWindow(0x0) , transient parent: QWindow(0x2586cff860)

      I think there are two problems:

      1. QWindow::setTransientParent should give QPlatformWindow the opportunity to do something (on Windows, it would call QWindowsWindow::updateTransientParent so that the owner for the underlying system window is updated)
      2. There seems to be a bug in QWindowsWindow::updateTransientParent at the moment. When checking if the underlying system window owner changed, it compares the handle of the transient parent window with the handle of the topmost owner window, not the current owner window. This makes updateTransientParent fail in the specific scenario described above.

      I think (1) would involve changing the interface of QPlatformWindow. I've submitted a tentative fix for (2).

      A small example is attached.

        For Gerrit Dashboard: QTBUG-69620
        # Subject Branch Project Status CR V

            mauro.persano Mauro Persano
            mauro.persano Mauro Persano
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change