From aff62828ea66aced8c4be2e5cd16b4fec53c6246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 1 Oct 2009 16:10:44 +0200 Subject: [PATCH] Make sure Gst.Bus.SyncHandler handlers are not garbage collected too early --- gstreamer-sharp/Bus.custom | 12 ++++++++++++ gstreamer-sharp/Gstreamer.metadata | 1 + 2 files changed, 13 insertions(+) diff --git a/gstreamer-sharp/Bus.custom b/gstreamer-sharp/Bus.custom index 873232eadb..b668954bcb 100644 --- a/gstreamer-sharp/Bus.custom +++ b/gstreamer-sharp/Bus.custom @@ -19,3 +19,15 @@ public bool AsyncSignalFunc (Gst.Message message) { bool ret = raw_ret; return ret; } + +[DllImport ("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl) ] +static extern void gst_bus_set_sync_handler (IntPtr raw, GstSharp.BusSyncHandlerNative func, IntPtr data); +private GstSharp.BusSyncHandlerWrapper sync_handler = null; + +public Gst.BusSyncHandler SyncHandler { + set { + GstSharp.BusSyncHandlerWrapper value_wrapper = new GstSharp.BusSyncHandlerWrapper (value); + sync_handler = value_wrapper; + gst_bus_set_sync_handler (Handle, value_wrapper.NativeDelegate, IntPtr.Zero); + } +} diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 7209b21009..6902e0d6b1 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -99,6 +99,7 @@ 1 AddSignalWatch true + 1 Last MiniObjectFlags.Last << 0