]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
viewproperties: Fix leaking file descriptors
[dolphin.git] / src / dolphinmainwindow.cpp
index 297ab000e80b8e9c79777889aa01e7dcb0742d8d..2697b12fb85334c9e31cadb4cf26875ed810edd5 100644 (file)
@@ -1726,7 +1726,11 @@ void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString &mountPath)
 {
     const QVector<DolphinViewContainer *> theViewContainers = viewContainers();
     for (DolphinViewContainer *viewContainer : theViewContainers) {
-        if (viewContainer && viewContainer->url().toLocalFile().startsWith(mountPath)) {
+        if (!viewContainer) {
+            continue;
+        }
+        const auto viewPath = viewContainer->url().toLocalFile();
+        if (viewPath.startsWith(mountPath + QLatin1String("/")) || viewPath == mountPath) {
             viewContainer->setUrl(QUrl::fromLocalFile(QDir::homePath()));
         }
     }