[gtk+/gtk-2-22] Prevent concurrent use of GTK+ 2 and 3



commit cbb01e6063f98572dc3958f95934a7b53419a5d1
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 18 22:40:50 2010 -0400

    Prevent concurrent use of GTK+ 2 and 3
    
    If we detect a gtk3-only symbol, error out early.

 gtk/gtkmain.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index f01f68c..fdf4730 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -628,6 +628,22 @@ setlocale_initialization (void)
 }
 
 static void
+check_mixed_deps (void)
+{
+  GModule *module;
+  gpointer func;
+
+  module = g_module_open (NULL, 0);
+
+  if (g_module_symbol (module, "gtk_widget_device_is_shadowed", &func))
+    {
+      g_error ("GTK+ 3 symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported");
+    }
+
+  g_module_close (module);
+}
+
+static void
 do_pre_parse_initialization (int    *argc,
 			     char ***argv)
 {
@@ -645,6 +661,8 @@ do_pre_parse_initialization (int    *argc,
 
   pre_initialized = TRUE;
 
+  check_mixed_deps ();
+
   gdk_pre_parse_libgtk_only ();
   gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
   



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