[network/kdeconnect-kde/release/26.08] plugins/sftp: sftp: don't spin forever removing Solid device entries from Dolphin

Albert Vaca Cintora <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c0b40ba26dc32776610342c2ae0be2a6c836bf20 by Albert Vaca Cintora, on behalf of Max Schwarz.
Committed on 23/07/2026 at 13:18.
Pushed by albertvaka into branch 'release/26.08'.

sftp: don't spin forever removing Solid device entries from Dolphin

SftpPlugin::removeFromDolphin() iterates the shared KFilePlacesModel to
remove the kdeconnect://<deviceId>/ place added by addToDolphin(). When
the KDE Connect Solid backend is installed, each device also shows up in
the model as a Solid *device* item with that exact URL. The loop matches
it and calls removePlace(), but removePlace() is a no-op for device
items, so rowCount() never decreases and the --i re-processes the same
row forever, pegging the daemon at 100% CPU on device disconnect.

Skip device items so we only ever remove the bookmark place kdeconnect
itself added; Solid device entries are owned by the Solid backend.

(cherry picked from commit 200ff3c5e45f9f3d78a54b99fc392657b5f5e2f4)

M  +7    -0    plugins/sftp/sftpplugin.cpp

https://invent.kde.org/network/kdeconnect-kde/-/commit/c0b40ba26dc32776610342c2ae0be2a6c836bf20

diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp
index 6c8a3bb14..c378262e8 100644
--- a/plugins/sftp/sftpplugin.cpp
+++ b/plugins/sftp/sftpplugin.cpp
@@ -67,6 +67,13 @@ void SftpPlugin::removeFromDolphin()
     QUrl kioUrl(QStringLiteral("kdeconnect://") + deviceId + QStringLiteral("/"));
     for (int i = 0; i < m_placesModel.rowCount(); ++i) {
         QModelIndex index = m_placesModel.index(i, 0);
+        // Skip Solid device entries: when the KDE Connect Solid backend is installed, each device
+        // shows up in the places model with a kdeconnect://<deviceId>/ URL that matches kioUrl.
+        // removePlace() is a no-op for device items, so trying to remove one here would never
+        // decrease rowCount() and the --i below would spin on the same row forever (100% CPU hang).
+        if (m_placesModel.isDevice(index)) {
+            continue;
+        }
         QUrl url = m_placesModel.url(index);
         if (url == kioUrl) {
             m_placesModel.removePlace(index);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.