[node] Destroy the RunLoop with the last Map object

The last map object to get destroyed will also destroy
the RunLoop (which will also destroy the AsyncTask).

This will clear any reference to the Node default main
loop and let it close.

Downside is that we need to make sure we are always calling
`map.release()`.
This commit is contained in:
Thiago Marcos P. Santos
2016-02-20 13:31:12 +02:00
parent 8a53c1a881
commit 3633fd7ebd
4 changed files with 18 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
#include <mbgl/map/map.hpp>
#include <mbgl/storage/file_source.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/util/run_loop.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
@@ -45,6 +46,7 @@ public:
std::unique_ptr<mbgl::FileRequest> request(const mbgl::Resource&, Callback);
mbgl::HeadlessView view;
std::shared_ptr<mbgl::util::RunLoop> loop;
std::unique_ptr<mbgl::Map> map;
std::exception_ptr error;