mapsforge / vtm

OpenGL vector map library - running on Android, iOS, Desktop and browser.
GNU Lesser General Public License v3.0
272 stars 89 forks source link

Bug in UrlTileDataSource #1074

Closed devemux86 closed 1 year ago

devemux86 commented 1 year ago

Discussed in https://github.com/mapsforge/vtm/discussions/1073

Originally posted by **wafn007** October 18, 2023 Hello! I think I found a bug in _vtm/src/org/oscim/tiling/source/UrlTileDataSource.java_ probably introduced in version 0.19 😯 In the override of _public void query(MapTile tile, ITileDataSink sink)_, the try clause now encapsulates the cache logic executed if _mUseCache_ is true . In that logic, if the decoding of the tile succeeds, a call is made to _sink.completed(QueryResult.SUCCESS)_ and then returns. The problem is that the outer try has a finally clause which ALSO calls the same method _sink.completed(res);_ but the second time the _completed_ method is called, it crashes with a null reference since the first call to completed sets an internal tile variable to NULL. If you do a blame on the file, you can see that in version 0.18, there is no try around the cache logic and therefor it works. In 0.19 it seems impossible to use _BitmapTileSource_ with a cache using the setCache method. Using version 0.18 everything works OK. Have I missed something? 🫤
devemux86 commented 1 year ago

@wafn007 Thanks for the report, it should be fixed now.