[Pkg-owncloud-commits] [owncloud-client] 43/159: Account: Destroy on exit.

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri May 1 13:05:20 UTC 2015


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

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 2a8c23aac3d44cb9db8a5a977834123b5d75bf1c
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Fri Mar 27 10:30:35 2015 +0100

    Account: Destroy on exit.
    
    During shutdown we want the account object to be deleted and
    therefore we need to be able to remove the strong reference
    in AccountManager.
---
 src/gui/accountstate.cpp | 4 +++-
 src/gui/application.cpp  | 3 ++-
 src/libsync/account.cpp  | 4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index 289717f..0ccbfbc 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -43,7 +43,9 @@ void AccountStateManager::setAccountState(AccountState *accountState)
         emit accountStateRemoved(_accountState);
     }
     _accountState = accountState;
-    emit accountStateAdded(accountState);
+    if (accountState) {
+        emit accountStateAdded(accountState);
+    }
 }
 
 void AccountStateManager::slotAccountAdded(AccountPtr account)
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 1e554cd..946384e 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -180,7 +180,8 @@ Application::Application(int &argc, char **argv) :
 
 Application::~Application()
 {
-    // qDebug() << "* OCC shutdown";
+    // Remove the account from the account manager so it can be deleted.
+    AccountManager::instance()->setAccount(AccountPtr());
 }
 
 void Application::slotLogin()
diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp
index 990b482..14e3ad2 100644
--- a/src/libsync/account.cpp
+++ b/src/libsync/account.cpp
@@ -63,7 +63,9 @@ void AccountManager::setAccount(AccountPtr account)
         emit accountRemoved(_account);
     }
     _account = account;
-    emit accountAdded(account);
+    if (account) {
+        emit accountAdded(account);
+    }
 }
 
 

-- 
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