[gtk+] gdk: Ensure resources registration happens once
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Ensure resources registration happens once
- Date: Tue, 26 Apr 2016 09:37:06 +0000 (UTC)
commit 0e14456f15412b1245cc8dab7df7021793d44441
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Apr 26 09:10:03 2016 +0100
gdk: Ensure resources registration happens once
Like GTK does it.
https://bugzilla.gnome.org/show_bug.cgi?id=765576
gdk/gdk.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 6c7464c..97ea213 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -269,6 +269,22 @@ gdk_add_option_entries_libgtk_only (GOptionGroup *group)
gdk_add_option_entries (group);
}
+static gpointer
+register_resources (gpointer dummy G_GNUC_UNUSED)
+{
+ _gdk_register_resource ();
+
+ return NULL;
+}
+
+static void
+gdk_ensure_resources (void)
+{
+ static GOnce register_resources_once = G_ONCE_INIT;
+
+ g_once (®ister_resources_once, register_resources, NULL);
+}
+
void
gdk_pre_parse (void)
{
@@ -277,7 +293,7 @@ gdk_pre_parse (void)
gdk_initialized = TRUE;
- _gdk_register_resource ();
+ gdk_ensure_resources ();
/* We set the fallback program class here, rather than lazily in
* gdk_get_program_class, since we don't want -name to override it.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]