-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
1.2.x
-
None
-
Mac OS v10.8.2, Qt v4.8.3, QtMobility v1.2.x
When a QGeoServiceProvider plugin is loaded at runtime like so:
QGeoServiceProvider *gsp = new QGeoServiceProvider("nokia");
EACH of the plugins installed on the system are loaded, instead of the deployed plugin (in the application bundle).
In the file:
QTMOBILITY/src/location/maps/qgeoserviceprovider.cpp
I've added code to check if the Application has been deployed. When it has been deployed it will only use the plugin that has been deployed with the bundle. Without this check the call to gpl.setFileName(paths.at); will cause a Bus Error: 10, when the Application tries to load a plugin from the QTMOBILITY directory.
My Edits are surrounded by #if defined(Q_WS_MAC)
void QGeoServiceProviderPrivate::loadDynamicPlugins(QMap<QString, QGeoServiceProviderFactory*> *plugins) { QStringList paths; paths << mobilityPlugins(QLatin1String("geoservices")); QPluginLoader qpl; #if defined(Q_WS_MAC) bool bundleContainsPlugin = false; #endif for (int i = 0; i < paths.count(); i++) { #if defined(Q_WS_MAC) QDir d(QCoreApplication::applicationDirPath()); d.cdUp(); d.cdUp(); if(paths.at(i).contains(d.absolutePath())){ bundleContainsPlugin=true; } #endif qpl.setFileName(paths.at(i)); QGeoServiceProviderFactory *f = qobject_cast<QGeoServiceProviderFactory*>(qpl.instance()); if (f) { QString name = f->providerName(); #if !defined QT_NO_DEBUG const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; if (showDebug) qDebug() << "Dynamic: found a service provider plugin with name" << name; #endif plugins->insertMulti(name, f); } #if defined(Q_WS_MAC) if(bundleContainsPlugin) return; #endif }
In addition, the function QGeoServiceProviderPrivate::loadPlugin loops through a list of plugin "candidates" using candidates[i]. This was also changed.
I've also modified:
QTMOBILITY/src/location/maps/qgeoserviceprovider.h
QTMOBILITY/src/location/maps/qgeoserviceprovider_p.cpp
I replaced QHash with QMap, to help preserve the order of the loaded plugins. (Since the calling function, mobilityPlugins, checks the search directories first, see qmobilitypluginsearch.h). In addition I've changed the pre-increment in the iterator to post-increments to ensure there is not skipping.