[gdk-pixbuf] queryloaders: Ensure we link to libgobject



commit 3a0531d84af702e4c8aed7801d9455cc95f3cb4a
Author: Colin Walters <walters verbum org>
Date:   Wed Oct 24 16:58:10 2012 -0400

    queryloaders: Ensure we link to libgobject
    
    This call is necessary to ensure we actually link against libgobject;
    otherwise it may be stripped if -Wl,--as-needed is in use.
    
    The reason we need to link against libgobject is because it now has
    a global constructor.  If the dynamically loaded modules happen
    to dlclose() libgobject, then reopen it again, we're in for trouble.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=686822
    
    Patch-suggested-by: Ryan Lortie <desrt desrt ca>
    Signed-off-by: Colin Walters <walters verbum org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686822

 gdk-pixbuf/queryloaders.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index 6087bd8..6246dd6 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -312,6 +312,17 @@ int main (int argc, char **argv)
 
 #endif
 
+	/* This call is necessary to ensure we actually link against libgobject;
+	 * otherwise it may be stripped if -Wl,--as-needed is in use.
+	 * 
+	 * The reason we need to link against libgobject is because it now has
+	 * a global constructor.  If the dynamically loaded modules happen
+	 * to dlclose() libgobject, then reopen it again, we're in for trouble.
+	 *
+	 * See: https://bugzilla.gnome.org/show_bug.cgi?id=686822
+	 */
+	g_type_ensure (G_TYPE_OBJECT);
+
         if (argc > 1 && strcmp (argv[1], "--update-cache") == 0) {
                 cache_file = gdk_pixbuf_get_module_file ();
                 first_file = 2;



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