Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.6.0 Beta
-
None
-
Reproduced with 32 and 64 bit builds on Windows 8.1 and 10, Breakage on XCB
-
cb6d4d1f16215694547514a6342e47854534223e (qtbase/5.6.0, 5.2.2016)
Description
To reproduce:
1. Run the sample provided
2. Click button
3. Close dialog
4. Click button again
5a. Windows: Watch how the assert halt program execution...
5b) Linux: 2nd toplevel temporarily flashes and is then reparented, shown with offset
Windows: WIn32 API CreateWindowEx failed ()Error messages output from the test applications:
WindowCreationData::create: CreateWindowEx failed (Cannot create a top-level child window.)
ASSERT: "platformWindow" in file kernel\qwindow.cpp, line 396
[The ViewWidget is recreated with parentHandle=0x0 and WS_CHILD]
Code sample:
#include <QMainWindow> #include <QDialog> #include <QPushButton> #include <QHBoxLayout> #include <QApplication> // ViewWidget class ViewWidget : public QWidget { public: ViewWidget(QWidget *parent = nullptr) : QWidget(parent) { winId(); // grab the native window handle to pass to external lib responsible for painting the view... } }; // ViewDialog class ViewDialog : public QDialog { public: ViewDialog(QWidget *parent = nullptr) : QDialog(parent) { setWindowTitle(tr("View Dialog")); resize(160, 90); ViewWidget* view = new ViewWidget; QHBoxLayout* layout = new QHBoxLayout; layout->addWidget(view); setLayout(layout); } }; // MainWindow class MainWindow : public QMainWindow { //Q_OBJECT public: MainWindow(QWidget *parent = nullptr) : QMainWindow(parent) { setWindowTitle(tr("Qt 5.6.0 beta bug Test")); resize(240, 120); QPushButton* button = new QPushButton("Click me!", this); connect(button, &QPushButton::clicked, this, &MainWindow::openDialog); setCentralWidget(button); } ~MainWindow() {} public slots: void openDialog() { static ViewDialog* dlg = nullptr; if (!dlg) dlg = new ViewDialog; dlg->show(); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow main; main.show(); return app.exec(); }
Attachments
Issue Links
- relates to
-
QTBUG-50561 QCocoaBackingStore::paintDevice() crashes when showing window after hide
- Closed
- resulted from
-
QTBUG-43344 macOS: Regression: closeEvent called twice (still not fixed)
- Closed