Commit 8416c5ff authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Cleanup IDisposable support

parent e93cab16
......@@ -105,12 +105,6 @@ namespace VideoLAN.LibVLC
private static extern void Init (NativeException e);
[DllImport ("libvlc.dll", EntryPoint="libvlc_exception_clear")]
private static extern void Clear (NativeException e);
/*[DllImport ("libvlc.dll",
EntryPoint="libvlc_exception_raised")]
private static extern int Raised (NativeException e);*/
[DllImport ("libvlc.dll",
EntryPoint="libvlc_exception_get_message")]
private static extern IntPtr GetMessage (NativeException e);
public NativeException ()
{
......@@ -142,6 +136,17 @@ namespace VideoLAN.LibVLC
/** IDisposable implementation. */
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
~NativeException ()
{
Dispose (false);
}
private void Dispose (bool disposing)
{
Clear (this);
}
......
......@@ -97,8 +97,20 @@ namespace VideoLAN.LibVLC
*/
public void Dispose ()
{
ex.Dispose ();
handle.Close ();
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (disposing)
{
ex.Dispose ();
if (handle != null)
handle.Close ();
}
ex = null;
handle = null;
}
};
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment