From 6d96e778ecda90a85a15025e9fa4d0738103d769 Mon Sep 17 00:00:00 2001 From: collecting Date: Tue, 23 Sep 2025 10:40:59 +0000 Subject: [PATCH] QObject::connect Error --- src/citron/bootmanager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/citron/bootmanager.cpp b/src/citron/bootmanager.cpp index 5cdedfb8a..20e2b414d 100644 --- a/src/citron/bootmanager.cpp +++ b/src/citron/bootmanager.cpp @@ -1124,9 +1124,12 @@ void GRenderWindow::OnEmulationStopping() { void GRenderWindow::showEvent(QShowEvent* event) { QWidget::showEvent(event); - // windowHandle() is not initialized until the Window is shown, so we connect it here. - connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged, - Qt::UniqueConnection); + // windowHandle() is not guaranteed to be initialized until after the window is shown. + // We connect here, but check for null to prevent a non-fatal error message on some platforms. + if (windowHandle()) { + connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged, + Qt::UniqueConnection); + } } bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {