Ensure that ~TileData happens on map thread

Fixes #1251
This commit is contained in:
John Firebaugh
2015-04-10 17:28:39 -07:00
parent 146a9f9fd3
commit 3efbb69e0c

View File

@@ -64,5 +64,9 @@ void TileData::reparse(Worker& worker, std::function<void()> callback) {
EnvironmentScope scope(tile->env, ThreadType::TileWorker, "TileWorker_" + tile->name);
tile->parse();
},
callback);
[tile, callback]() {
// `tile` is bound in this lambda to ensure that if it's the last owning pointer,
// destruction happens on the map thread, not the worker thread.
callback();
});
}