Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public static void ReleaseMemorySprite(Sprite sprite, DebugLevel logLevel = Debu
}

// 'sprite.texture' could be called only from main thread
// checking sprite.IsNull is enough until we are in main thread
if (sprite.IsNull())
// Unity's == (used by IsNull) throws off the main thread, e.g. from a Reference finalizer
if (ReferenceEquals(sprite, null))
return;

UniTask.Post(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public static void ReleaseMemoryTexture(Texture2D obj, DebugLevel logLevel = Deb
UnityEngine.Object.DestroyImmediate(obj);
return;
}
if (obj.IsNull())
// Unity's == (used by IsNull) throws off the main thread, e.g. from a Reference finalizer
if (ReferenceEquals(obj, null))
return;

UniTask.Post(() =>
Expand Down