diff --git a/csync/src/csync.c b/csync/src/csync.c index 1b99428b1b..2390eaae88 100644 --- a/csync/src/csync.c +++ b/csync/src/csync.c @@ -573,15 +573,6 @@ int csync_commit(CSYNC *ctx) { } ctx->statedb.db = NULL; -#ifdef USE_NEON - rc = owncloud_commit(ctx); - if (rc < 0) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "commit failed: %s", - ctx->error_string ? ctx->error_string : ""); - goto out; - } -#endif - _csync_clean_ctx(ctx); ctx->remote.read_from_db = 0; diff --git a/csync/src/csync.h b/csync/src/csync.h index a3c490e13c..85a4bfb963 100644 --- a/csync/src/csync.h +++ b/csync/src/csync.h @@ -337,7 +337,7 @@ int csync_update(CSYNC *ctx); int csync_reconcile(CSYNC *ctx); /** - * @brief Commit the sync results to journal + * @brief Re-initializes the csync context * * @param ctx The context to commit. * diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index b7b769c7c7..ec9de3bfaf 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -708,8 +708,12 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) qDebug() << "Permissions of the root folder: " << _remotePerms[QLatin1String("")]; } + // Re-init the csync context to free memory + csync_commit(_csync_ctx); + // The map was used for merging trees, convert it to a list: _syncedItems = _syncItemMap.values().toVector(); + _syncItemMap.clear(); // free memory // Adjust the paths for the renames. for (SyncFileItemVector::iterator it = _syncedItems.begin(); @@ -863,6 +867,12 @@ void SyncEngine::finalize() { _thread.quit(); _thread.wait(); + +#ifdef USE_NEON + // De-init the neon HTTP(S) connections + csync_owncloud_commit(ctx); +#endif + csync_commit(_csync_ctx); qDebug() << "CSync run took " << _stopWatch.addLapTime(QLatin1String("Sync Finished")); diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index e616c6d6b1..63990abcb6 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -141,6 +141,7 @@ private: static bool _syncRunning; //true when one sync is running somewhere (for debugging) + // Must only be acessed during update and reconcile QMap _syncItemMap; // should be called _syncItems (present tense). It's the items from the _syncItemMap but