diff --git a/gst/gst_private.h b/gst/gst_private.h index ab7a9797fa..049142cb28 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -135,6 +135,9 @@ G_GNUC_INTERNAL void _priv_gst_allocator_cleanup (void); G_GNUC_INTERNAL void _priv_gst_caps_features_cleanup (void); G_GNUC_INTERNAL void _priv_gst_caps_cleanup (void); +/* called from gst_task_cleanup_all(). */ +G_GNUC_INTERNAL void _priv_gst_element_cleanup (void); + /* Private registry functions */ G_GNUC_INTERNAL gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry); diff --git a/gst/gstelement.c b/gst/gstelement.c index dd1f9dcab0..761627b719 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -3423,3 +3423,12 @@ gst_element_call_async (GstElement * element, GstElementCallAsyncFunc func, g_thread_pool_push (gst_element_pool, async_data, NULL); } + +void +_priv_gst_element_cleanup (void) +{ + if (gst_element_pool) { + g_thread_pool_free (gst_element_pool, FALSE, TRUE); + gst_element_pool = NULL; + } +} diff --git a/gst/gsttask.c b/gst/gsttask.c index 2972e06ba0..d8f17a7e1d 100644 --- a/gst/gsttask.c +++ b/gst/gsttask.c @@ -386,6 +386,9 @@ gst_task_cleanup_all (void) if ((klass = g_type_class_peek (GST_TYPE_TASK))) { init_klass_pool (klass); } + + /* GstElement owns a GThreadPool */ + _priv_gst_element_cleanup (); } /**