gst-full: Prevent multiple calls to gst_init_static_plugins()
authorXavier Claessens <xavier.claessens@collabora.com>
Thu, 1 Oct 2020 14:43:36 +0000 (10:43 -0400)
committerXavier Claessens <xavier.claessens@collabora.com>
Mon, 5 Oct 2020 21:17:46 +0000 (17:17 -0400)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/191>

scripts/generate_init_static_plugins.py

index c2ed12251288e3fedbbd0bdaadb122dec2e2e55e..15725d8dc28bea6cf36db684492c2c17c138d64f 100644 (file)
@@ -12,7 +12,11 @@ $plugins_declaration
 void
 gst_init_static_plugins (void)
 {
-  $plugins_registration
+  static gsize initialization_value = 0;
+  if (g_once_init_enter (&initialization_value)) {
+    $plugins_registration
+    g_once_init_leave (&initialization_value, 1);
+  }
 }
 ''')