mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-02-18 07:32:30 +00:00
Dispose IDisposable objects on close.
Objects that implement the IDisposable interface didn't get collected by GC.
This commit is contained in:
parent
e37ed56a43
commit
d744432a50
1 changed files with 6 additions and 0 deletions
|
@ -76,6 +76,12 @@ public class ObjectManager : IPlugin
|
||||||
|
|
||||||
private void OnClose(object sender, EventArgs e)
|
private void OnClose(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
foreach (var pair in _objects)
|
||||||
|
{
|
||||||
|
if (pair.Value is IDisposable disposable)
|
||||||
|
disposable.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
_objects.Clear();
|
_objects.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue