Repository navigation
Working towards GlyphAtlas safety - #995
Conversation
c772fac to
4b7c4a3
Compare
|
Awesome, this totally solves my use case (which you can try via https://gist.github.com/incanus/43d0faa730347a3a5d01 BTW; start in DC at |
I don't think it is right now. If the user changes the Stylesheet, we'll destruct the current stylesheet and swap it with another one. This is the reason we've held the Style object as a shared_ptr so far. However, this isn't a good solution either. Instead, we should abort all tile parsing (not sure if there's a good way to do this quickly) since we won't need the old parsed tiles anyway when switching the style. |
|
The following approach should work in the current start/stop scheme. We can store a weak Style pointer. Before using it any time convert it to a shared pointer using weak_ptr.lock(). If the Style object is destroyed in Map::stop, this conversion would fail and return a nullptr. However this also means that any data member in Style object should not be cached in other classes. Any time a data member of Style needs to be accessed, it would have to be done via .lock() on this weak_ptr. |
4e2b83d to
6325f1e
Compare
|
I'd prefer to figure out how to abort all asynchronous operations before deallocating the style, rather than a weak-pointer based solution. For now I just reverted to shared pointers and |
|
Build failure is likely unrelated to this change. Ticketed: #1001, going to merge. |
|
I spoke too soon, the glyph atlas ownership changes looked like they were destabilizing. I backed them out in 0c985c0 and will open a refactoring ticket for post-beta. |
Refs #957
First part: move atlas ownership to Style. This follows gl-js and just makes sense -- whenever the style changes the atlases should be blown away.
@kkaefer, is it safe yet to pass Style by reference into
Source::update⇢VectorTileData⇢TileParseras I've done here? I'm still not clear on what parts are running in a different thread that's not guaranteed to be shut down before the Style is deallocated. If this isn't safe I can fall back to ashared_from_thissolution.Second part: Index glyph use by tile pointer value, not tile ID. There can be multiple tiles with the same ID, but from different sources.