From ac256f05ff0f9aae575b175ba4e78ccbf6f8f292 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 22 Apr 2020 19:20:48 +0100 Subject: [PATCH] Close graphics context while it still exists --- extern/osgQt/GraphicsWindowQt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extern/osgQt/GraphicsWindowQt.cpp b/extern/osgQt/GraphicsWindowQt.cpp index af963c04b5..aa9b4bbdb6 100644 --- a/extern/osgQt/GraphicsWindowQt.cpp +++ b/extern/osgQt/GraphicsWindowQt.cpp @@ -119,6 +119,13 @@ bool GLWidget::event( QEvent* event ) enqueueDeferredEvent(QEvent::ParentChange); return true; } +#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) + else if (event->type() == QEvent::PlatformSurface && static_cast(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed) + { + if (_gw) + _gw->close(); + } +#endif // perform regular event handling return QGLWidget::event( event );