diff --git a/autotests/integration/debug_console_test.cpp b/autotests/integration/debug_console_test.cpp --- a/autotests/integration/debug_console_test.cpp +++ b/autotests/integration/debug_console_test.cpp @@ -522,9 +522,7 @@ QCOMPARE(c->internalWindow(), console->windowHandle()); QVERIFY(c->isDecorated()); c->closeWindow(); - QEXPECT_FAIL("", "BUG 369858", Continue); QVERIFY(destroyedSpy.wait()); - QCOMPARE(console->windowHandle()->isVisible(), false); } } diff --git a/debug_console.h b/debug_console.h --- a/debug_console.h +++ b/debug_console.h @@ -101,6 +101,9 @@ DebugConsole(); virtual ~DebugConsole(); +protected: + void showEvent(QShowEvent *event) override; + private: void initGLTab(); diff --git a/debug_console.cpp b/debug_console.cpp --- a/debug_console.cpp +++ b/debug_console.cpp @@ -536,6 +536,22 @@ m_ui->openGLExtensionsLabel->setText(extensionsString(openGLExtensions())); } +void DebugConsole::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + + // delay the connection to the show event as in ctor the windowHandle returns null + connect(windowHandle(), &QWindow::visibleChanged, this, + [this] (bool visible) { + if (visible) { + // ignore + return; + } + deleteLater(); + } + ); +} + DebugConsoleDelegate::DebugConsoleDelegate(QObject *parent) : QStyledItemDelegate(parent) {