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

[REG 4->5] When using multiple monitors and one monitor is disconnected causing the window to move then winId() is not updated

    XMLWordPrintable

Details

    • 75e5ffe0f71bfccd6ae31d1b437dfea58bfb28a7

    Description

      When a multi-head setup is used, QWidget::winId() is broken. (I have a test case attached which can reproduce the bug).
      QWidget/QWindow may re-create the underlying window and change WinId() at runtime. However, QEvent::WinIdChange is not always emitted and QWidget::winId() always return the old value. Then, I got error message from QBackStore stating that the window has no handle and the window disappeared.

      Steps to reproduce the bug:
      1. Run the test program and use "xwininfo" command to check its window ID.
      2. Plug in an external monitor
      3. Use xrandr to get a dual monitor setup with the external monitor attached to the right border of the primary monitor.
      4. Move the window of the test program to the external monitor.
      5. Use xrandr to turn off the external monitor.
      6. My test program will move the window back to the primary monitor when the external monitor is turned off (it listens to QDesktopWindow::screenCountChanged() signal)
      7. Use "xwininfo" command to inspect the window of the test program
      8. You'll notice that the window ID is changed as shown by xwininfo. However, effectiveWindowId() still returns the old value.

      If you repeat the steps for many times, the test program will crash with a broken QBackingStore and an invalid window handle.

      This only happens in Qt5. I also tested Qt 4.8 and it does not have the bug.
      Please fix the regression bug. Forgetting to update the internal winId can crash the program so this is very critical.
      Thanks!

      Attachments

        Issue Links

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

          Activity

            People

              dzedsystems Dyami Caliri
              pcman Hong Jen Yee
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes