git.videolan.org
/
vlc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Explicit native exception methods scope
[vlc.git]
/
bindings
/
cil
/
src
/
marshal.cs
diff --git
a/bindings/cil/src/marshal.cs
b/bindings/cil/src/marshal.cs
index
c210283
..
b68059b
100644
(file)
--- a/
bindings/cil/src/marshal.cs
+++ b/
bindings/cil/src/marshal.cs
@@
-1,11
+1,11
@@
-/*
- *
libvlc.cs - libvlc-control CIL binding
s
- *
- *
$Id$
+/*
*
+ *
@file marshal.c
s
+ *
@brief Common LibVLC objects marshalling utilities
+ *
@ingroup Internals
*/
/**********************************************************************
*/
/**********************************************************************
- * Copyright (C) 2007
Rémi Denis-Courmont.
*
+ * Copyright (C) 2007
-2009 Rémi Denis-Courmont.
*
* This program is free software; you can redistribute and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; version 2 of the license, or (at *
* This program is free software; you can redistribute and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; version 2 of the license, or (at *
@@
-27,16
+27,21
@@
using System.Runtime.InteropServices;
namespace VideoLAN.LibVLC
{
/**
namespace VideoLAN.LibVLC
{
/**
- * Abstract safe handle class for non-NULL pointers
- * (Microsoft.* namespace has a similar class, but lets stick to System.*)
+ * @brief NonNullHandle: abstract safe handle class for non-NULL pointers
+ * @ingroup Internals
+ * Microsoft.* namespace has a similar class. However we want to use the
+ * System.* namespace only.
*/
*/
-
public
abstract class NonNullHandle : SafeHandle
+
internal
abstract class NonNullHandle : SafeHandle
{
protected NonNullHandle ()
: base (IntPtr.Zero, true)
{
}
{
protected NonNullHandle ()
: base (IntPtr.Zero, true)
{
}
+ /**
+ * System.Runtime.InteropServices.SafeHandle::IsInvalid.
+ */
public override bool IsInvalid
{
get
public override bool IsInvalid
{
get
@@
-44,23
+49,49
@@
namespace VideoLAN.LibVLC
return handle == IntPtr.Zero;
}
}
return handle == IntPtr.Zero;
}
}
+
+ protected abstract void Destroy ();
+
+ /**
+ * System.Runtime.InteropServices.SafeHandle::ReleaseHandle.
+ */
+ protected override bool ReleaseHandle ()
+ {
+ Destroy ();
+ return true;
+ }
+
};
};
- public class BaseObject<HandleT> : IDisposable where HandleT : SafeHandle
+ /**
+ * @brief BaseObject: generic wrapper around a safe handle.
+ * @ingroup Internals
+ * This is the baseline for all managed LibVLC objects which wrap
+ * an unmanaged LibVLC pointer.
+ */
+ public class BaseObject : IDisposable
{
{
- protected NativeException ex;
- protected
HandleT self;
+ protected NativeException ex;
/**< buffer for LibVLC exceptions */
+ protected
SafeHandle handle; /**< wrapped safe handle */
- internal BaseObject (
HandleT self
)
+ internal BaseObject ()
{
{
- this.self = self;
ex = new NativeException ();
ex = new NativeException ();
+ this.handle = null;
+ }
+
+ protected void Raise ()
+ {
+ ex.Raise ();
}
}
+ /**
+ * IDisposable::Dispose.
+ */
public void Dispose ()
{
ex.Dispose ();
public void Dispose ()
{
ex.Dispose ();
-
self
.Close ();
+
handle
.Close ();
}
};
};
}
};
};