summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-04-25 15:20:31 -0700
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-04-26 11:07:48 -0700
commit0eb58278f21c7d767b07449b6b167c6859283d5d (patch)
tree5c7f53165b8d1dcd72155c8f4a4630d6e482d2bd
parent4344812ef5ef3b5b67e9f313e0c3cc87b3e95c46 (diff)
downloadqtlocation-mapboxgl-0eb58278f21c7d767b07449b6b167c6859283d5d.tar.gz
[qt] Fix crash on the example app when launching multiple windows
We need to have a valid context when destroying QMapboxGL.
-rw-r--r--platform/qt/app/mapwindow.cpp7
-rw-r--r--platform/qt/app/mapwindow.hpp1
2 files changed, 8 insertions, 0 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index f6d5473192..390d89915a 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 c484114ec0..6c05f03562 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();