From 2cbd318f1da432024dc724a644da98da2b52692b Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 11 Jun 2015 17:39:15 +0200 Subject: [PATCH] Don't try to load plugins if QT_NO_LIBRARY is set. Any plugin loading is impossible then and the code won't even compile. Change-Id: I81e49ff87ae1a609521d526f5098a0d44cc28f7c Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qplatformprintplugin.cpp | 4 ++++ src/widgets/styles/qgtk2painter.cpp | 2 ++ src/widgets/styles/qgtkstyle_p.cpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index 091cc6f008..9adf39ffcd 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -55,6 +55,7 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin() static QPlatformPrinterSupport *printerSupport = 0; +#ifndef QT_NO_LIBRARY static void cleanupPrinterSupport() { #ifndef QT_NO_PRINTER @@ -62,6 +63,7 @@ static void cleanupPrinterSupport() #endif printerSupport = 0; } +#endif // !QT_NO_LIBRARY /*! \internal @@ -73,6 +75,7 @@ static void cleanupPrinterSupport() */ QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get() { +#ifndef QT_NO_LIBRARY if (!printerSupport) { const QMultiMap keyMap = loader()->keyMap(); if (!keyMap.isEmpty()) @@ -80,6 +83,7 @@ QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get() if (printerSupport) qAddPostRoutine(cleanupPrinterSupport); } +#endif // !QT_NO_LIBRARY return printerSupport; } diff --git a/src/widgets/styles/qgtk2painter.cpp b/src/widgets/styles/qgtk2painter.cpp index 489d456617..ea8afbc93c 100644 --- a/src/widgets/styles/qgtk2painter.cpp +++ b/src/widgets/styles/qgtk2painter.cpp @@ -93,6 +93,7 @@ namespace QGtk2PainterPrivate { static void initGtk() { +#ifndef QT_NO_LIBRARY static bool initialized = false; if (!initialized) { // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 @@ -123,6 +124,7 @@ static void initGtk() initialized = true; } +#endif // !QT_NO_LIBRARY } // To recover alpha we apply the gtk painting function two times to diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 0e119a11ae..00682c1c0f 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -326,6 +326,7 @@ void QGtkStylePrivate::gtkWidgetSetFocus(GtkWidget *widget, bool focus) */ void QGtkStylePrivate::resolveGtk() const { +#ifndef QT_NO_LIBRARY // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0 QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0); @@ -427,6 +428,7 @@ void QGtkStylePrivate::resolveGtk() const gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync"); gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init"); +#endif // !QT_NO_LIBRARY } /* \internal @@ -593,11 +595,13 @@ void QGtkStylePrivate::cleanupGtkWidgets() static bool resolveGConf() { +#ifndef QT_NO_LIBRARY if (!QGtkStylePrivate::gconf_client_get_default) { QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default"); QGtkStylePrivate::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string"); QGtkStylePrivate::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool"); } +#endif // !QT_NO_LIBRARY return (QGtkStylePrivate::gconf_client_get_default !=0); }