[Pkg-owncloud-commits] [owncloud-client] 80/171: Fix crash when deleting account while sync is running #4337

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit 71ad94ddb220408ab044ed0c9fee1600ebd2ad59
Author: Christian Kamm <mail at ckamm.de>
Date:   Thu Jan 7 13:54:26 2016 +0100

    Fix crash when deleting account while sync is running #4337
---
 src/gui/folder.cpp | 25 ++++++++++++++++++++-----
 src/gui/folder.h   |  2 +-
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 0db67d1..0483021 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -247,7 +247,9 @@ QString Folder::remotePath() const
 
 QUrl Folder::remoteUrl() const
 {
-    Q_ASSERT(_accountState);
+    if (!_accountState) {
+        return QUrl("http://deleted-account");
+    }
     return Account::concatUrlPath(_accountState->account()->davUrl(), remotePath());
 }
 
@@ -298,7 +300,10 @@ void Folder::slotRunEtagJob()
 {
     qDebug() << "* Trying to check" << remoteUrl().toString() << "for changes via ETag check. (time since last sync:" << (_timeSinceLastSyncDone.elapsed() / 1000) << "s)";
 
-    Q_ASSERT(_accountState );
+    if (!_accountState) {
+        qDebug() << "Can't run EtagJob, account is deleted";
+        return;
+    }
 
     AccountPtr account = _accountState->account();
 
@@ -703,7 +708,11 @@ bool Folder::estimateState(QString fn, csync_ftw_type_e t, SyncFileStatus* s)
 
 void Folder::saveToSettings() const
 {
-    Q_ASSERT(_accountState);
+    if (!_accountState) {
+        qDebug() << "Can't save folder to settings, account is deleted";
+        return;
+    }
+
     auto settings = _accountState->settings();
     settings->beginGroup(QLatin1String("Folders"));
     FolderDefinition::save(*settings, _definition);
@@ -714,7 +723,10 @@ void Folder::saveToSettings() const
 
 void Folder::removeFromSettings() const
 {
-    Q_ASSERT(_accountState);
+    if (!_accountState) {
+        qDebug() << "Can't remove folder from settings, account is deleted";
+        return;
+    }
 
     auto  settings = _accountState->settings();
     settings->beginGroup(QLatin1String("Folders"));
@@ -851,7 +863,10 @@ bool Folder::proxyDirty()
 
 void Folder::startSync(const QStringList &pathList)
 {
-    Q_ASSERT(_accountState);
+    if (!_accountState) {
+        qDebug() << "Can't startSync, account is deleted";
+        return;
+    }
 
     Q_UNUSED(pathList)
     if (!_csync_ctx) {
diff --git a/src/gui/folder.h b/src/gui/folder.h
index ea7ad71..eacbc6d 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -282,7 +282,7 @@ private:
     void createGuiLog(const QString& filename, SyncFileStatus status, int count,
                        const QString& renameTarget = QString::null );
 
-    AccountState* _accountState;
+    QPointer<AccountState> _accountState;
     FolderDefinition _definition;
 
     SyncResult _syncResult;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list