Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.3
-
None
-
-
c956eb8ed (dev), 8ee25c66d (6.7), 169a2f212 (6.7.0), 2c0a4d6c5 (6.6), 9e2dcc749 (tqtc/lts-6.5), 6c036012b (dev), 540002579 (6.8), 4c7456c2b (6.7), 1d409c085 (dev), a94b3deb4 (6.8), febf188e3 (6.7), 681bc93b8 (tqtc/lts-6.5)
Description
When a native window widget (child of another top-level window) is added as a tab to QTabWidget and then the QTabWidget is reparented to a new top-level window, the widget's top-level system extra window is not reparented to the new top-level window as expected. Due to this, when the old top-level window goes out of scope, the widget's extra window is destroyed and further access to the widget's window handle would result in a crash.
Steps to Reproduce:
- Create a QWidget as a native window and parent it to another top-level native window.
- Add QWidget as a tab to a QTabWidget using QTabWidget::addTab
- Reparent the QTabWidget to a new top-level window aka newTLW using QWidget::setParent.
- Destroy the old top-level window.
- QWidget's top-level system extra window would be destroyed and the QWidget would contain a dangling pointer.
Expected Behavior:
The QWidget's top-level system extra window should be reparented to the new top-level window when the QTabWidget is reparented.
Actual Behavior:
When the old top-level window goes out of scope, child windows associated with the old top-level window's extra are destroyed, including the system extra window. This leaves them QWidget with a dangling extra window pointer. Any future access to this window handle would result in a crash.
Additional Notes
A simple reproducer app is attached QTBUG-122747.zip .
Attachments
For Gerrit Dashboard: QTBUG-122747 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
582634,1 | Add missing break in tst_QWidget::reparentWindowHandles() | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: NEW | 0 | 0 |