make sure we retain shared state when destructing the map object

refs #261
This commit is contained in:
Konstantin Käfer
2014-05-30 17:00:47 +02:00
parent 3e7f801de1
commit 78fda8bb62
18 changed files with 174 additions and 110 deletions

View File

@@ -56,12 +56,23 @@ void TileData::cancel() {
}
}
void TileData::beforeParse() {}
void TileData::reparse() {
beforeParse();
// We're creating a new work request. The work request deletes itself after it executed
// the after work handler
new uv::work<std::shared_ptr<TileData>>(
map.getLoop(),
[](std::shared_ptr<TileData> &tile) { tile->parse(); },
[](std::shared_ptr<TileData> &tile) { tile->map.update(); },
[](std::shared_ptr<TileData> &tile) {
tile->parse();
},
[](std::shared_ptr<TileData> &tile) {
tile->afterParse();
tile->map.update();
},
shared_from_this());
}
void TileData::afterParse() {}