diff options
| author | Amol Godbole <[email protected]> | 2024-09-15 18:49:43 -0500 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2024-10-08 09:15:38 +0000 |
| commit | 2328cb7f923e5c6eeb7617eebf3ee73c0bb8e50b (patch) | |
| tree | 723387f28e23e81bf4f829180fd059c915f51f65 /src/dolphinviewcontainer.cpp | |
| parent | f5840f52be54078de2658f84a973313e997bd491 (diff) | |
DolphinViewContainer: Delay changing the url
KCoreDirLister::itemsDeleted() signal is being emitted twice for the
same url. This results in Dolphin displaying an incorrect location.
Delay changing the url instead of delaying
DolphinView::currentDirectoryRemoved() so that the check for current
directory being removed in KFileItemModel::slotItemsDeleted() occurs
correctly, while still ensuring that KCoreDirLister is not prematurely
modified.
BUG: 492277, BUG: 473377
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index e55519d04..c89621dbd 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -975,10 +975,13 @@ void DolphinViewContainer::slotCurrentDirectoryRemoved() const QString dirPath = url().toLocalFile(); const QString newPath = getNearestExistingAncestorOfPath(dirPath); const QUrl newUrl = QUrl::fromLocalFile(newPath); - setUrl(newUrl); - } - - showMessage(xi18n("Current location changed, <filename>%1</filename> is no longer accessible.", location), KMessageWidget::Warning); + // #473377: Delay changing the url to avoid modifying KCoreDirLister before KCoreDirListerCache::deleteDir() returns. + QTimer::singleShot(0, this, [&, newUrl, location] { + setUrl(newUrl); + showMessage(xi18n("Current location changed, <filename>%1</filename> is no longer accessible.", location), KMessageWidget::Warning); + }); + } else + showMessage(xi18n("Current location changed, <filename>%1</filename> is no longer accessible.", location), KMessageWidget::Warning); } void DolphinViewContainer::slotOpenUrlFinished(KJob *job) |
