diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-03-18 02:05:02 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-03-20 14:38:08 +0200 |
commit | 490c172b35c9f48d95b4c1a38003a00520ba27b8 (patch) | |
tree | faab7f23c57cb0a4b4b1a047f4a05d92d43efc6b /linux | |
parent | 0cdf21c62d1f4ed8f54bd63b3f26459ef78a78d0 (diff) | |
download | qtlocation-mapboxgl-490c172b35c9f48d95b4c1a38003a00520ba27b8.tar.gz |
Delete the GLFWView object at exit
Also destroy the glfwWindow we create. This leak was probably harmless
but a nice cleanup helps us debug other serious memory leaks.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/main.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/linux/main.cpp b/linux/main.cpp index 697941164a..4d5474c02f 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -1,4 +1,5 @@ #include <mbgl/mbgl.hpp> +#include <mbgl/util/std.hpp> #include <mbgl/util/uv.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/platform/platform.hpp> @@ -13,7 +14,7 @@ #include <sstream> -GLFWView *view = nullptr; +std::unique_ptr<GLFWView> view; void quit_handler(int) { if (view) { @@ -62,7 +63,7 @@ int main(int argc, char *argv[]) { sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); - view = new GLFWView(); + view = mbgl::util::make_unique<GLFWView>(); mbgl::SQLiteCache cache("/tmp/mbgl-cache.db"); mbgl::DefaultFileSource fileSource(&cache); |