Commit 96505aed authored by Nicolas Fella's avatar Nicolas Fella

[tagsaction] Don't crash on multiple files

Summary:
Tagging multiple files is not supported and thus we never create m_metadata for it. However, we start the tags listing  and as soon as tags are found m_metadata is accesses which results in a crash.

This patch delays the tags listing until m_metadata has been initialized

BUG: 401733

Test Plan: Select multiple files in Dolphin, right click -> no crash

Reviewers: elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: #baloo

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D20361
parent 617fe3fc
...@@ -81,7 +81,6 @@ TagsFileItemAction::TagsFileItemAction(QObject* parent, const QVariantList&) ...@@ -81,7 +81,6 @@ TagsFileItemAction::TagsFileItemAction(QObject* parent, const QVariantList&)
m_menu->addAction(newAction); m_menu->addAction(newAction);
m_menu->addSeparator(); m_menu->addSeparator();
m_tagsLister.openUrl(QUrl("tags:/"), KCoreDirLister::OpenUrlFlag::Reload);
} }
TagsFileItemAction::~TagsFileItemAction() TagsFileItemAction::~TagsFileItemAction()
...@@ -98,6 +97,7 @@ QList<QAction*> TagsFileItemAction::actions(const KFileItemListProperties& fileI ...@@ -98,6 +97,7 @@ QList<QAction*> TagsFileItemAction::actions(const KFileItemListProperties& fileI
} }
m_metaData = new KFileMetaData::UserMetaData(fileItemInfos.urlList()[0].toLocalFile()); m_metaData = new KFileMetaData::UserMetaData(fileItemInfos.urlList()[0].toLocalFile());
m_tagsLister.openUrl(QUrl("tags:/"), KCoreDirLister::OpenUrlFlag::Reload);
return {m_menu->menuAction()}; return {m_menu->menuAction()};
} }
......
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