mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
Ref/unref the Src field of Gst.Event/Message when setting it
This commit is contained in:
parent
6e766fc1d5
commit
48fc341b06
2 changed files with 20 additions and 2 deletions
|
@ -27,6 +27,12 @@ public ulong Timestamp {
|
|||
[DllImport ("gstreamersharpglue-0.10") ]
|
||||
extern static uint gstsharp_gst_event_get_src_offset ();
|
||||
|
||||
[DllImport ("gobject-2.0.dll")]
|
||||
extern static IntPtr g_object_ref (IntPtr handle);
|
||||
|
||||
[DllImport ("gobject-2.0.dll")]
|
||||
extern static void g_object_unref (IntPtr handle);
|
||||
|
||||
static uint src_offset = gstsharp_gst_event_get_src_offset ();
|
||||
public Gst.Object Src {
|
||||
get {
|
||||
|
@ -39,9 +45,12 @@ public Gst.Object Src {
|
|||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
if (Src != null)
|
||||
g_object_unref (Src.Handle);
|
||||
|
||||
unsafe {
|
||||
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||
*raw_ptr = value == null ? IntPtr.Zero : value.Handle;
|
||||
*raw_ptr = value == null ? IntPtr.Zero : g_object_ref (value.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,12 @@ public ulong Timestamp {
|
|||
[DllImport ("gstreamersharpglue-0.10") ]
|
||||
extern static uint gstsharp_gst_message_get_src_offset ();
|
||||
|
||||
[DllImport ("gobject-2.0.dll")]
|
||||
extern static IntPtr g_object_ref (IntPtr handle);
|
||||
|
||||
[DllImport ("gobject-2.0.dll")]
|
||||
extern static void g_object_unref (IntPtr handle);
|
||||
|
||||
static uint src_offset = gstsharp_gst_message_get_src_offset ();
|
||||
public Gst.Object Src {
|
||||
get {
|
||||
|
@ -39,9 +45,12 @@ public Gst.Object Src {
|
|||
if (!IsWritable)
|
||||
throw new ApplicationException ();
|
||||
|
||||
if (Src != null)
|
||||
g_object_unref (Src.Handle);
|
||||
|
||||
unsafe {
|
||||
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + src_offset);
|
||||
*raw_ptr = value == null ? IntPtr.Zero : value.Handle;
|
||||
*raw_ptr = value == null ? IntPtr.Zero : g_object_ref (value.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue