Skip to content

Commit

Permalink
Fix disposal with recursive tilesets (#344)
Browse files Browse the repository at this point in the history
* Update TilesRendererBase.js

* Update TilesRendererBase.js
  • Loading branch information
gkjohnson committed Jun 1, 2023
1 parent 9491ab6 commit 9e7048b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/base/TilesRendererBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,12 +623,15 @@ export class TilesRendererBase {

dispose() {

const lruCache = this.lruCache;
this.traverse( tile => {
// Make sure we've collected all children before disposing of the internal tilesets to avoid
// dangling children that we inadvertantly skip when deleting the nested tileset.
const toRemove = [];
this.traverse( t => toRemove.push( t ) );
for ( let i = 0, l = toRemove.length; i < l; i ++ ) {

lruCache.remove( tile );
lruCache.remove( toRemove[ i ] );

Check warning on line 632 in src/base/TilesRendererBase.js

View workflow job for this annotation

GitHub Actions / build (10.x)

'lruCache' is not defined

Check warning on line 632 in src/base/TilesRendererBase.js

View workflow job for this annotation

GitHub Actions / build (12.x)

'lruCache' is not defined

Check warning on line 632 in src/base/TilesRendererBase.js

View workflow job for this annotation

GitHub Actions / build (14.x)

'lruCache' is not defined

} );
}

this.stats = {
parsing: 0,
Expand Down

0 comments on commit 9e7048b

Please sign in to comment.