[network/kdeconnect-kde] plugins/sftp: sftp: don't spin forever removing Solid device entries from Dolphin
Max Schwarz <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 200ff3c5e45f9f3d78a54b99fc392657b5f5e2f4 by Max Schwarz.
Committed on 23/07/2026 at 11:45.
Pushed by albertvaka into branch 'master'.
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.
M +7 -0 plugins/sftp/sftpplugin.cpp
https://invent.kde.org/network/kdeconnect-kde/-/commit/200ff3c5e45f9f3d78a54b99fc392657b5f5e2f4
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);