Commit a993a597 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark Committed by Elvis Angelaccio
Browse files

fix crashing on launch

parent 49e8b67b
Pipeline #46489 passed with stage
in 6 minutes and 59 seconds
......@@ -112,7 +112,7 @@ QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) cons
return m_plugin->versionControlActions(items);
} else {
QList<QAction*> actions;
for (const auto &plugin : qAsConst(m_plugins)) {
for (const QPointer<KVersionControlPlugin> &plugin : qAsConst(m_plugins)) {
actions << plugin->outOfVersionControlActions(items);
}
return actions;
......@@ -306,14 +306,18 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& director
initPlugins();
// Verify whether the current directory is under a version system
for (const auto &plugin : qAsConst(m_plugins)) {
for (const QPointer<KVersionControlPlugin> &plugin : qAsConst(m_plugins)) {
if (!plugin) {
continue;
}
// first naively check if we are at working copy root
const QString fileName = directory.path() + '/' + plugin->fileName();
if (QFile::exists(fileName)) {
m_localRepoRoot = directory.path();
return plugin;
}
auto root = plugin->localRepositoryRoot(directory.path());
const QString root = plugin->localRepositoryRoot(directory.path());
if (!root.isEmpty()) {
m_localRepoRoot = root;
return plugin;
......
......@@ -146,7 +146,7 @@ private:
bool m_pluginsInitialized;
KVersionControlPlugin* m_plugin;
QList<KVersionControlPlugin*> m_plugins;
QList<QPointer<KVersionControlPlugin>> m_plugins;
UpdateItemStatesThread* m_updateItemStatesThread;
friend class UpdateItemStatesThread;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment