Free thread pools in gst_deinit()
authorJonas Holmberg <jonashg@axis.com>
Thu, 15 Aug 2013 13:35:08 +0000 (15:35 +0200)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 16 Aug 2013 09:32:25 +0000 (10:32 +0100)
gst/gst.c

index d51cb2f..fd676a3 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -932,6 +932,7 @@ parse_goption_arg (const gchar * opt,
 void
 gst_deinit (void)
 {
+  GstBinClass *bin_class;
   GstClock *clock;
 
   GST_INFO ("deinitializing GStreamer");
@@ -941,6 +942,13 @@ gst_deinit (void)
     return;
   }
 
+  bin_class = GST_BIN_CLASS (g_type_class_peek (gst_bin_get_type ()));
+  if (bin_class->pool != NULL) {
+    g_thread_pool_free (bin_class->pool, FALSE, TRUE);
+    bin_class->pool = NULL;
+  }
+  gst_task_cleanup_all ();
+
   g_slist_foreach (_priv_gst_preload_plugins, (GFunc) g_free, NULL);
   g_slist_free (_priv_gst_preload_plugins);
   _priv_gst_preload_plugins = NULL;