[totem/wip/hadess/properties-vaapi-crash-fix: 7/10] properties: Use GOnce to init GStreamer
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/properties-vaapi-crash-fix: 7/10] properties: Use GOnce to init GStreamer
- Date: Mon, 14 Jan 2019 16:02:07 +0000 (UTC)
commit 717c3253bc3605204bcef269ba7915ad3f073ac3
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 10 13:28:40 2019 +0100
properties: Use GOnce to init GStreamer
This makes sure that the initialisation is thread safe.
src/totem-properties-main.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/totem-properties-main.c b/src/totem-properties-main.c
index e4b765ed..124a37ac 100644
--- a/src/totem-properties-main.c
+++ b/src/totem-properties-main.c
@@ -38,7 +38,6 @@
#include "totem-mime-types.h"
static GType tpp_type = 0;
-static gboolean backend_inited = FALSE;
static void property_page_provider_iface_init
(NautilusPropertyPageProviderIface *iface);
static GList *totem_properties_get_pages
@@ -79,10 +78,18 @@ property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface)
iface->get_pages = totem_properties_get_pages;
}
+static gpointer
+init_backend (gpointer data)
+{
+ gst_init (NULL, NULL);
+ return NULL;
+}
+
static GList *
totem_properties_get_pages (NautilusPropertyPageProvider *provider,
GList *files)
{
+ static GOnce backend_inited = G_ONCE_INIT;
NautilusFileInfo *file;
char *uri;
GtkWidget *page, *label;
@@ -107,10 +114,7 @@ totem_properties_get_pages (NautilusPropertyPageProvider *provider,
return NULL;
/* okay, make the page, init'ing the backend first if necessary */
- if (backend_inited == FALSE) {
- gst_init (NULL, NULL);
- backend_inited = TRUE;
- }
+ g_once (&backend_inited, init_backend, NULL);
uri = nautilus_file_info_get_uri (file);
label = gtk_label_new (_("Audio/Video"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]