fix assets not being disposed when a content manager is disposed
This commit is contained in:
parent
e4a7ca5826
commit
ff94a8149e
|
@ -119,7 +119,7 @@ namespace StardewModdingAPI.Framework.Content
|
||||||
/// <param name="predicate">Matches the asset keys to invalidate.</param>
|
/// <param name="predicate">Matches the asset keys to invalidate.</param>
|
||||||
/// <param name="dispose">Whether to dispose invalidated assets. This should only be <c>true</c> when they're being invalidated as part of a dispose, to avoid crashing the game.</param>
|
/// <param name="dispose">Whether to dispose invalidated assets. This should only be <c>true</c> when they're being invalidated as part of a dispose, to avoid crashing the game.</param>
|
||||||
/// <returns>Returns the removed keys (if any).</returns>
|
/// <returns>Returns the removed keys (if any).</returns>
|
||||||
public IEnumerable<string> Remove(Func<string, Type, bool> predicate, bool dispose = false)
|
public IEnumerable<string> Remove(Func<string, Type, bool> predicate, bool dispose)
|
||||||
{
|
{
|
||||||
List<string> removed = new List<string>();
|
List<string> removed = new List<string>();
|
||||||
foreach (string key in this.Cache.Keys.ToArray())
|
foreach (string key in this.Cache.Keys.ToArray())
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace StardewModdingAPI.Framework.ContentManagers
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}, dispose);
|
||||||
|
|
||||||
return removeAssetNames.Select(p => Tuple.Create(p.Key, p.Value));
|
return removeAssetNames.Select(p => Tuple.Create(p.Key, p.Value));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue