fix assets not being disposed when a content manager is disposed

This commit is contained in:
Jesse Plamondon-Willard 2019-12-12 23:46:32 -05:00
parent e4a7ca5826
commit ff94a8149e
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 2 additions and 2 deletions

View File

@ -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())

View File

@ -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));
} }