[perl-Gtk2] Avoid trying to re-register a GType for GConnectFlags



commit 80f70a1b073bae3b0702a6e5265e05b580258d23
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Fri Apr 6 00:04:03 2012 +0200

    Avoid trying to re-register a GType for GConnectFlags
    
    Glib now does this for us.

 NEWS             |    5 +++++
 xs/GtkBuilder.xs |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 35fbd76..3fe2b50 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Overview of changes in Gtk2 <next>
+=================================
+
+* Avoid trying to re-register a GType for GConnectFlags.
+
 Overview of changes in Gtk2 1.242
 =================================
 
diff --git a/xs/GtkBuilder.xs b/xs/GtkBuilder.xs
index df68521..7fdbae6 100644
--- a/xs/GtkBuilder.xs
+++ b/xs/GtkBuilder.xs
@@ -21,7 +21,12 @@ gtk2perl_connect_flags_get_type (void)
 			{ G_CONNECT_SWAPPED, "G_CONNECT_SWAPPED", "swapped" },
 			{ 0, NULL, NULL }
 		};
-		etype = g_flags_register_static ("GConnectFlags", values);
+		/* This is actually a race condition, but I don't think it
+		 * matters too much in this case. */
+		etype = g_type_from_name ("GConnectFlags");
+		if (etype == 0) {
+			etype = g_flags_register_static ("GConnectFlags", values);
+		}
 	}
 	return etype;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]