From c5eae31cf7cd30d2a42533bd9b60f89149261d2e Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 10 Jul 2017 21:42:21 -0400 Subject: [PATCH] ges: Ref the GES class to avoid later deadlock This ensure that that all class are initialized from the main thread, avoid class initialization in random thread, which may cause deadlocks. https://bugzilla.gnome.org/show_bug.cgi?id=784769 --- ges/ges.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/ges/ges.c b/ges/ges.c index 46ebf1db17..af5edd9b7d 100644 --- a/ges/ges.c +++ b/ges/ges.c @@ -76,25 +76,22 @@ ges_init_post (GOptionContext * context, GOptionGroup * group, gpointer data, /* register clip classes with the system */ - GES_TYPE_TEST_CLIP; - GES_TYPE_URI_CLIP; - GES_TYPE_TITLE_CLIP; - GES_TYPE_TRANSITION_CLIP; - GES_TYPE_OVERLAY_CLIP; - GES_TYPE_OVERLAY_TEXT_CLIP; + g_type_class_ref (GES_TYPE_TEST_CLIP); + g_type_class_ref (GES_TYPE_URI_CLIP); + g_type_class_ref (GES_TYPE_TITLE_CLIP); + g_type_class_ref (GES_TYPE_TRANSITION_CLIP); + g_type_class_ref (GES_TYPE_OVERLAY_CLIP); + g_type_class_ref (GES_TYPE_OVERLAY_TEXT_CLIP); - GES_TYPE_GROUP; + g_type_class_ref (GES_TYPE_GROUP); /* register formatter types with the system */ - GES_TYPE_PITIVI_FORMATTER; - GES_TYPE_COMMAND_LINE_FORMATTER; - GES_TYPE_XML_FORMATTER; + g_type_class_ref (GES_TYPE_PITIVI_FORMATTER); + g_type_class_ref (GES_TYPE_COMMAND_LINE_FORMATTER); + g_type_class_ref (GES_TYPE_XML_FORMATTER); /* Register track elements */ - GES_TYPE_EFFECT; - - /* Register interfaces */ - GES_TYPE_META_CONTAINER; + g_type_class_ref (GES_TYPE_EFFECT); ges_asset_cache_init (); @@ -149,6 +146,23 @@ void ges_deinit (void) { _ges_uri_asset_cleanup (); + + g_type_class_unref (g_type_class_peek (GES_TYPE_TEST_CLIP)); + g_type_class_unref (g_type_class_peek (GES_TYPE_URI_CLIP)); + g_type_class_unref (g_type_class_peek (GES_TYPE_TITLE_CLIP)); + g_type_class_unref (g_type_class_peek (GES_TYPE_TRANSITION_CLIP)); + g_type_class_unref (g_type_class_peek (GES_TYPE_OVERLAY_CLIP)); + g_type_class_unref (g_type_class_peek (GES_TYPE_OVERLAY_TEXT_CLIP)); + + g_type_class_unref (g_type_class_peek (GES_TYPE_GROUP)); + + /* register formatter types with the system */ + g_type_class_unref (g_type_class_peek (GES_TYPE_PITIVI_FORMATTER)); + g_type_class_unref (g_type_class_peek (GES_TYPE_COMMAND_LINE_FORMATTER)); + g_type_class_unref (g_type_class_peek (GES_TYPE_XML_FORMATTER)); + + /* Register track elements */ + g_type_class_unref (g_type_class_peek (GES_TYPE_EFFECT)); } #ifndef GST_DISABLE_OPTION_PARSING