diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-10-25 11:05:20 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-25 06:15:12 +0200 |
commit | 17184438015f4d4bf93d8aee2993fe5b54e24555 (patch) | |
tree | 96911825ef3d340c58348a5b70d65211ca9adb1b | |
parent | ab52443dc5dd1a1c16395c2eca425aeb31a4dcd5 (diff) |
Don't ignore debug plugins on Mac when release plugins aren't available
Previously, we unconditionally ignored any plugins whose names ended
with _debug.dylib. This makes the mediaservice plugins unusable on Mac
if Qt is configured to build plugins as debug-only (which is
incidentally the default).
Change-Id: I5a8981b2251e803fa233b74c968f6eaa452d367c
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
-rw-r--r-- | src/multimedia/qmediapluginloader.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/multimedia/qmediapluginloader.cpp b/src/multimedia/qmediapluginloader.cpp index 32f3369..284ff59 100644 --- a/src/multimedia/qmediapluginloader.cpp +++ b/src/multimedia/qmediapluginloader.cpp @@ -121,15 +121,36 @@ QStringList QMediaPluginLoader::availablePlugins() const foreach (const QString &path, paths) { QDir typeDir(path + m_location); - foreach (const QString &file, typeDir.entryList(QDir::Files)) { + foreach (const QString &file, typeDir.entryList(QDir::Files, QDir::Name)) { #if defined(Q_OS_MAC) if (!imageSuffix.isEmpty()) { // Only add appropriate images if (file.lastIndexOf(imageSuffix, -6) == -1) continue; - } else { // Ignore any images with common suffixes - if (file.endsWith(QLatin1String("_debug.dylib")) || - file.endsWith(QLatin1String("_profile.dylib"))) - continue; + } else { + int foundSuffix = file.lastIndexOf(QLatin1String("_debug.dylib")); + if (foundSuffix == -1) { + foundSuffix = file.lastIndexOf(QLatin1String("_profile.dylib")); + } + if (foundSuffix != -1) { + /* + If this is a "special" version of the plugin, prefer the release + version, where available. + Avoids warnings like: + + objc[23101]: Class TransparentQTMovieView is implemented in both + libqqt7engine_debug.dylib and libqqt7engine.dylib. One of the two + will be used. Which one is undefined. + + Note, this code relies on QDir::Name sorting! + */ + + QString preferred = + typeDir.absoluteFilePath(file.left(foundSuffix) + QLatin1String(".dylib")); + + if (plugins.contains(preferred)) { + continue; + } + } } #elif defined(Q_OS_UNIX) // Ignore separate debug files |