Avoid loading multiple bearer plugins of the same key

There may be duplicated debug plugins, loading both will cause
crash.

Change-Id: Icc2a3643c318844bc7f2e149a6434e95de2449b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jiang Jiang 2012-07-10 10:32:03 +02:00 committed by Qt by Nokia
parent e8aa56b74b
commit fe40b8f4ad

View File

@ -383,8 +383,13 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
QFactoryLoader *l = loader();
const PluginKeyMap keyMap = l->keyMap();
const PluginKeyMapConstIterator cend = keyMap.constEnd();
QStringList addedEngines;
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
const QString &key = it.value();
if (addedEngines.contains(key))
continue;
addedEngines.append(key);
if (QBearerEngine *engine = qLoadPlugin<QBearerEngine, QBearerEnginePlugin>(l, key)) {
if (key == QLatin1String("generic"))
generic = engine;