Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created September 15, 2021 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torarnv/0df0e8f1303cccf74e16e3d566ed82a2 to your computer and use it in GitHub Desktop.
Save torarnv/0df0e8f1303cccf74e16e3d566ed82a2 to your computer and use it in GitHub Desktop.
diff --git c/src/widgets/kernel/qwidget.cpp i/src/widgets/kernel/qwidget.cpp
index fcb18d7c187..b7db1c56b0c 100644
--- c/src/widgets/kernel/qwidget.cpp
+++ i/src/widgets/kernel/qwidget.cpp
@@ -8488,8 +8488,10 @@ bool QWidgetPrivate::close()
// Close native widgets via QWindow::close() in order to run QWindow
// close code. The QWidget-specific close code in handleClose() will
// in this case be called from the Close event handler in QWidgetWindow.
- if (QWindow *widgetWindow = windowHandle())
- return widgetWindow->close();
+ if (QWindow *widgetWindow = windowHandle()) {
+ if (widgetWindow->handle())
+ return widgetWindow->close();
+ }
return handleClose(QWidgetPrivate::CloseWithEvent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment