Priority: P1: Critical
Affects Version/s: 5.3.1
Fix Version/s: 5.4.0 Beta
Environment:Linux 3.1, X11, XCB backend, Qt 5.3, multi-head setup with dual monitor.
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.
|For Gerrit Dashboard: QTBUG-40681|
|93372,7||Update widget winId when screen changes||5.3||qt/qtbase||Status: ABANDONED||+2||0|
|93571,2||Update widget winId when screen changes||5.3.2||qt/qtbase||Status: ABANDONED||+1||0|
|95048,3||Update widget winId when screen changes||5.4||qt/qtbase||Status: MERGED||+2||0|