diff options
author | Matthias Clasen <mclasen@redhat.com> | 2011-02-08 13:49:16 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-02-08 13:49:16 -0500 |
commit | d2bdd50a0b1f754540fe4038862c7c983513875c (patch) | |
tree | 5029fff9a26260de19ae1762976eac7414809bd5 /gtk/gtkmodules.c | |
parent | 99b5af11e4047181626f44987a2716d694b6babe (diff) | |
download | gtk+-d2bdd50a0b1f754540fe4038862c7c983513875c.tar.gz |
Extend the mixed-dependency check to modules as well
This helps prevent accidents with GTK_PATH.
Diffstat (limited to 'gtk/gtkmodules.c')
-rw-r--r-- | gtk/gtkmodules.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c index bd9ba5710f..5fa2abf8a1 100644 --- a/gtk/gtkmodules.c +++ b/gtk/gtkmodules.c @@ -26,7 +26,8 @@ #include "gtksettings.h" #include "gtkdebug.h" #include "gtkprivate.h" /* GTK_LIBDIR */ -#include "gtkintl.h" +#include "gtkmainprivate.h" +#include "gtkintl.h" #include <gmodule.h> @@ -236,7 +237,16 @@ find_module (const gchar *name) } module = g_module_open (module_name, G_MODULE_BIND_LOCAL | G_MODULE_BIND_LAZY); - g_free(module_name); + + if (_gtk_module_has_mixed_deps (module)) + { + g_warning ("GTK+ module %s cannot be loaded.\n" + "GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.", module_name); + g_module_close (module); + module = NULL; + } + + g_free (module_name); return module; } @@ -264,7 +274,7 @@ load_module (GSList *module_list, for (l = gtk_modules; l; l = l->next) { info = l->data; - if (g_slist_find_custom (info->names, name, + if (g_slist_find_custom (info->names, name, (GCompareFunc)strcmp)) { info->ref_count++; @@ -273,7 +283,7 @@ load_module (GSList *module_list, } } - if (!success) + if (!success) { module = find_module (name); @@ -353,8 +363,13 @@ load_module (GSList *module_list, } } else - g_message ("Failed to load module \"%s\": %s", name, g_module_error ()); - + { + const gchar *error = g_module_error (); + + g_message ("Failed to load module \"%s\"%s%s", + name, error ? ": " : "", error ? error : ""); + } + return module_list; } |