From 5c0d7da4aa3b2323b418bcf668981a16b61a9244 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Tue, 23 Dec 2025 13:31:29 +0100 Subject: DolphinView: observeCreatedDirectory take into account last / of m_url BUG: 513345 --- src/views/dolphinview.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 47a5461ff..6297efafe 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1835,6 +1835,11 @@ void DolphinView::observeCreatedDirectory(const QUrl &newDirectoryUrl) return; } + if (!m_url.isParentOf(newDirectoryUrl)) { + // the view has moved + return; + } + // since this is async make sure the selection state hasn't change in the meantime std::function condition([this]() { return !m_container->controller()->selectionManager()->hasSelection(); @@ -1843,7 +1848,8 @@ void DolphinView::observeCreatedDirectory(const QUrl &newDirectoryUrl) // in case, a new hiercachy was created, select the first folder in its parent path auto targetUrl = newDirectoryUrl; auto parentUrl = targetUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); - while (parentUrl != m_url) { + const auto containingUrl = m_url.adjusted(QUrl::StripTrailingSlash); + while (parentUrl != containingUrl) { targetUrl = parentUrl; parentUrl = targetUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); } -- cgit v1.3