Index: src/views/versioncontrol/versioncontrolobserver.h =================================================================== --- src/views/versioncontrol/versioncontrolobserver.h +++ src/views/versioncontrol/versioncontrolobserver.h @@ -114,6 +114,7 @@ private: typedef QPair ItemState; + typedef QPair VCSPlugin; void updateItemStates(); @@ -157,7 +158,7 @@ bool m_pluginsInitialized; KVersionControlPlugin* m_plugin; - QList m_plugins; + QList m_plugins; UpdateItemStatesThread* m_updateItemStatesThread; friend class UpdateItemStatesThread; Index: src/views/versioncontrol/versioncontrolobserver.cpp =================================================================== --- src/views/versioncontrol/versioncontrolobserver.cpp +++ src/views/versioncontrol/versioncontrolobserver.cpp @@ -303,7 +303,7 @@ if (enabledPlugins.contains((*it)->name())) { KVersionControlPlugin* plugin = (*it)->createInstance(this); if (plugin) { - m_plugins.append(plugin); + m_plugins.append( qMakePair(plugin, plugin->fileName()) ); } } } @@ -323,12 +323,12 @@ // Verify whether the current directory contains revision information // like .svn, .git, ... - foreach (KVersionControlPlugin* plugin, m_plugins) { - const QString fileName = directory.path() + '/' + plugin->fileName(); + for (const auto &it : qAsConst(m_plugins)) { + const QString fileName = directory.path() + '/' + it.second; if (QFile::exists(fileName)) { // The score of this plugin is 0 (best), so we can just return this plugin, // instead of going through the plugin scoring procedure, we can't find a better one ;) - return plugin; + return it.first; } // Version control systems like Git provide the version information @@ -342,10 +342,10 @@ QUrl upUrl = KIO::upUrl(dirUrl); int upUrlCounter = 1; while ((upUrlCounter < bestScore) && (upUrl != dirUrl)) { - const QString fileName = dirUrl.path() + '/' + plugin->fileName(); + const QString fileName = dirUrl.path() + '/' + it.second; if (QFile::exists(fileName)) { if (upUrlCounter < bestScore) { - bestPlugin = plugin; + bestPlugin = it.first; bestScore = upUrlCounter; } break;