From: Kevin Ottens Date: Tue, 18 Aug 2020 08:23:52 +0000 (+0200) Subject: Make sure we don't assert when calling fileStatus X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~222 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f6e36523d2999b6f3af91e9e4f4948e5f50afa3b;p=nextcloud-desktop.git Make sure we don't assert when calling fileStatus It happens that sometimes we leak a directory path ending with a slash, but that violates fileStatus' precondition so let's catch it early and skip such path. Of course the right fix would be a larger swipe in the sync engine and around it to not use naked strings anymore but rely on the typesystem. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp index 1c69da171..ecafde700 100644 --- a/src/libsync/syncfilestatustracker.cpp +++ b/src/libsync/syncfilestatustracker.cpp @@ -290,8 +290,14 @@ void SyncFileStatusTracker::slotSyncFinished() // Clear the sync counts to reduce the impact of unsymetrical inc/dec calls (e.g. when directory job abort) QHash oldSyncCount; std::swap(_syncCount, oldSyncCount); - for (auto it = oldSyncCount.begin(); it != oldSyncCount.end(); ++it) + for (auto it = oldSyncCount.begin(); it != oldSyncCount.end(); ++it) { + // Don't announce folders, fileStatus expect only paths without '/', otherwise it asserts + if (it.key().endsWith('/')) { + continue; + } + emit fileStatusChanged(getSystemDestination(it.key()), fileStatus(it.key())); + } } void SyncFileStatusTracker::slotSyncEngineRunningChanged()