-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ClientDataSource losing features after scene change #2118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far its working fine with this change. Will inform you guys, if faced with any issue regarding it.
Thanks @matteblair for getting on this. This is an interesting behavior. I thought and confirmed that I think this is going to cause issues during a scene update which is actually updating the datasource itself, and tileManager will continue to use old source (loaded) tiles, instead of throwing these away. It might make sense to handle this in |
I've reverted the original change and fixed this behavior in a different way now, so as to avoid unforeseen side effects with other data source types. As @tallytalwar suggested, the While I was at it, I also managed to clean up some of the glue code between |
@matteblair looks great to me. Just a couple of clarifications:
|
In full agreement. I find it over-complicated, but I think this was added when we refactored some work for mbtiles. Also in agreement that its a much bigger task. |
Done - hopefully that makes the new behavior clearer. The original issue of
I don't think I did? I removed some unused methods in |
Added a few more small-ish related changes and rebased on master. |
Calls to native ClientDataSource functions are internally synchronized with a mutex
895e9e1
to
00adea8
Compare
Thanks for clearing all this up @matteblair. Merging. |
When the current scene is changed, the
TileManager
instance used by the old scene runscancelTileTasks()
to stop pending asynchronous work. The implementation of this method also calledclearData()
on all of the managedTileSource
s.ClientDataSource::clearData()
not only removes the tiles generated from its stored features, but also removes the features themselves. This should definitely not happen when the scene changes.It's not clear whyclearData()
was used here at all, so I've simply removed the call.The behavior of
clearData()
(which is to clear caches) was mistakenly conflated with the need to clear the set of features added to aClientDataSource
. These two behaviors are both necessary, but should be separate. So I've givenClientDataSource
a new method calledclearFeatures()
that removes added features, and made itsclearData()
implementation fall back to that of the base class. So now when a scene is reloaded andclearData()
is invoked, theClientDataSource
features won't be cleared. But a client can explicitly clear the features throughMapData$clear
.This issue demonstrates how messy some of the
TileSource
abstraction is. A better, more complete solution would be to refactor these interfaces, but that will take more time.Resolves #2117