diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp index 74a545d31..3b74618e3 100644 --- a/include/mbgl/platform/default/glfw_view.hpp +++ b/include/mbgl/platform/default/glfw_view.hpp @@ -11,8 +11,6 @@ #define GL_GLEXT_PROTOTYPES #include -#include - class GLFWView : public mbgl::View { public: GLFWView(bool fullscreen = false, bool benchmark = false); @@ -95,7 +93,7 @@ private: mbgl::util::Timer frameTick; GLFWwindow *window = nullptr; - std::atomic_flag clean = ATOMIC_FLAG_INIT; + bool dirty = false; }; #endif diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index bdadaa6f3..7fb47ff7c 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -417,15 +417,12 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) { void GLFWView::run() { auto callback = [&] { if (glfwWindowShouldClose(window)) { - frameTick.stop(); runLoop.stop(); - return; } glfwPollEvents(); - const bool dirty = !clean.test_and_set(); if (dirty) { const double started = glfwGetTime(); @@ -444,6 +441,8 @@ void GLFWView::run() { if (benchmark) { map->update(mbgl::Update::Repaint); } + + dirty = false; } }; @@ -476,7 +475,7 @@ void GLFWView::deactivate() { } void GLFWView::invalidate() { - clean.clear(); + dirty = true; glfwPostEmptyEvent(); }