diff options
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 21 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 75652b0902..aeb78e88b4 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -126,9 +126,30 @@ void QFactoryLoader::update() QStringList plugins = QDir(path).entryList(QDir::Files); QLibraryPrivate *library = 0; + +#ifdef Q_OS_MAC + // Loading both the debug and release version of the cocoa plugins causes the objective-c runtime + // to print "duplicate class definitions" warnings. Detect if QFactoryLoader is about to load both, + // skip one of them (below). + // + // ### FIXME find a proper solution + // + const bool isLoadingDebugAndReleaseCocoa = plugins.contains("libqcocoa_debug.dylib") && plugins.contains("libqcocoa.dylib"); +#endif for (int j = 0; j < plugins.count(); ++j) { QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); +#ifdef Q_OS_MAC + if (isLoadingDebugAndReleaseCocoa) { +#ifdef QT_DEBUG + if (fileName.contains(QStringLiteral("libqcocoa.dylib"))) + continue; // Skip release plugin in debug mode +#else + if (fileName.contains(QStringLiteral("libqcocoa_debug.dylib"))) + continue; // Skip debug plugin in release mode +#endif + } +#endif if (qt_debug_component()) { qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; } diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 26692ca3d4..8d2e890d87 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE # define QLIBRARY_AS_DEBUG true #endif -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#if defined(Q_OS_UNIX) // We don't use separate debug and release libs on UNIX, so we want // to allow loading plugins, regardless of how they were built. # define QT_NO_DEBUG_PLUGIN_CHECK |