diff --git a/common/headless_view.cpp b/common/headless_view.cpp index ed00f48e8..ace41d38c 100644 --- a/common/headless_view.cpp +++ b/common/headless_view.cpp @@ -163,6 +163,10 @@ HeadlessView::~HeadlessView() { #endif } +void HeadlessView::notify() { + // no-op +} + void HeadlessView::notify_map_change(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) { // no-op } diff --git a/common/headless_view.hpp b/common/headless_view.hpp index a8ce4aa32..42f9c46da 100644 --- a/common/headless_view.hpp +++ b/common/headless_view.hpp @@ -21,6 +21,7 @@ public: void resize(uint16_t width, uint16_t height, float pixelRatio); + void notify(); void notify_map_change(MapChange change, timestamp delay = 0); void make_active(); void swap(); diff --git a/include/mbgl/map/tile_data.hpp b/include/mbgl/map/tile_data.hpp index 07cf19c5c..823523679 100644 --- a/include/mbgl/map/tile_data.hpp +++ b/include/mbgl/map/tile_data.hpp @@ -41,7 +41,7 @@ public: public: TileData(Tile::ID id, Map &map, const util::ptr &source); - ~TileData(); + virtual ~TileData(); void request(); void cancel(); diff --git a/include/mbgl/util/uv-worker.h b/include/mbgl/util/uv-worker.h index a9c9aff50..eff1169a2 100644 --- a/include/mbgl/util/uv-worker.h +++ b/include/mbgl/util/uv-worker.h @@ -21,11 +21,13 @@ struct uv_worker_s { #ifndef NDEBUG unsigned long thread_id; #endif + uv_loop_t *loop; uv_messenger_t *msgr; uv_chan_t chan; const char *name; int count; uv_worker_close_cb close_cb; + int active; }; int uv_worker_init(uv_worker_t *worker, uv_loop_t *loop, int count, const char *name); diff --git a/src/map/map.cpp b/src/map/map.cpp index f71ecdb27..4b797ceae 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -58,6 +58,15 @@ Map::~Map() { if (async) { stop(); } + + // Explicitly reset all pointers. + texturepool.reset(); + sprite.reset(); + spriteAtlas.reset(); + glyphStore.reset(); + glyphAtlas.reset(); + style.reset(); + fileSource.reset(); } uv::worker &Map::getWorker() { @@ -265,8 +274,14 @@ void Map::setStyleJSON(std::string newStyleJSON, const std::string &base) { // TODO: Make threadsafe. styleJSON.swap(newStyleJSON); sprite.reset(); - assert(style); + if (!style) { + style = std::make_shared