Skip to content

Commit 892c2a1

Browse files
committed
fix double-dispose in WeatherParticle
1 parent 16bda43 commit 892c2a1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Intersect.Client.Core/Maps/WeatherParticle.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public partial class WeatherParticle : IWeatherParticle
4141

4242
private int yVelocity;
4343

44+
private bool _disposed = false;
45+
4446
public WeatherParticle(List<IWeatherParticle> RemoveParticle, int xvelocity, int yvelocity, AnimationDescriptor anim)
4547
{
4648
TransmittionTimer = Timing.Global.MillisecondsUtc;
@@ -150,7 +152,13 @@ public void Update()
150152

151153
public void Dispose()
152154
{
153-
animInstance.Dispose();
155+
if (_disposed) return;
156+
157+
_disposed = true;
158+
159+
animInstance?.Dispose();
160+
161+
GC.SuppressFinalize(this);
154162
}
155163

156164
~WeatherParticle()

0 commit comments

Comments
 (0)