mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Fixes to asset manager ref counter.
This commit is contained in:
parent
f4e375a2cd
commit
7dbcc39086
@ -337,6 +337,7 @@ export class AssetManagerBase implements Disposable {
|
||||
if (asset.dispose) asset.dispose();
|
||||
delete this.assets[path];
|
||||
delete this.assetsRefCount[path];
|
||||
delete this.assetsLoaded[path];
|
||||
return asset;
|
||||
}
|
||||
|
||||
@ -346,6 +347,8 @@ export class AssetManagerBase implements Disposable {
|
||||
if (asset.dispose) asset.dispose();
|
||||
}
|
||||
this.assets = {};
|
||||
this.assetsLoaded = {};
|
||||
this.assetsRefCount = {};
|
||||
}
|
||||
|
||||
isLoadingComplete (): boolean {
|
||||
@ -365,10 +368,9 @@ export class AssetManagerBase implements Disposable {
|
||||
}
|
||||
|
||||
// dispose asset only if it's not used by others
|
||||
disposeAsset(path: string, a?: string) {
|
||||
disposeAsset(path: string) {
|
||||
if (--this.assetsRefCount[path] === 0) {
|
||||
const asset = this.assets[path];
|
||||
if (asset.dispose) asset.dispose();
|
||||
this.remove(path)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user