From 0eb58278f21c7d767b07449b6b167c6859283d5d Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 25 Apr 2018 15:20:31 -0700 Subject: [PATCH] [qt] Fix crash on the example app when launching multiple windows We need to have a valid context when destroying QMapboxGL. --- platform/qt/app/mapwindow.cpp | 7 +++++++ platform/qt/app/mapwindow.hpp | 1 + 2 files changed, 8 insertions(+) diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index f6d547319..390d89915 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -22,6 +22,13 @@ MapWindow::MapWindow(const QMapboxGLSettings &settings) setWindowIcon(QIcon(":icon.png")); } +MapWindow::~MapWindow() +{ + // Make sure we have a valid context so we + // can delete the QMapboxGL. + makeCurrent(); +} + void MapWindow::selfTest() { if (m_bearingAnimation) { diff --git a/platform/qt/app/mapwindow.hpp b/platform/qt/app/mapwindow.hpp index c484114ec..6c05f0356 100644 --- a/platform/qt/app/mapwindow.hpp +++ b/platform/qt/app/mapwindow.hpp @@ -29,6 +29,7 @@ class MapWindow : public QGLWidget public: MapWindow(const QMapboxGLSettings &); + ~MapWindow(); void selfTest();