[Pkg-owncloud-commits] [owncloud-client] 174/470: Notifications: Check if the account is connected before querying.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:00 UTC 2016


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 7f22a073125457e1ebf27255a4f0043714fe34fd
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Fri Mar 11 15:16:09 2016 +0100

    Notifications: Check if the account is connected before querying.
    
    Also avoid memory leaks if it is not connected.
---
 src/gui/servernotificationhandler.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gui/servernotificationhandler.cpp b/src/gui/servernotificationhandler.cpp
index 94ff131..14a9e07 100644
--- a/src/gui/servernotificationhandler.cpp
+++ b/src/gui/servernotificationhandler.cpp
@@ -28,16 +28,19 @@ ServerNotificationHandler::ServerNotificationHandler(QObject *parent)
 
 void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr)
 {
-    /* start the notification fetch job as well */
-    if( !ptr) {
+    // check connectivity and credentials
+    if( !( ptr && ptr->isConnected() && ptr->account() &&
+           ptr->account()->credentials() &&
+           ptr->account()->credentials()->ready() ) ) {
+        deleteLater();
         return;
     }
-
     // check if the account has notifications enabled. If the capabilities are
     // not yet valid, its assumed that notifications are available.
-    if( ptr->account() && ptr->account()->capabilities().isValid() ) {
+    if( ptr->account()->capabilities().isValid() ) {
         if( ! ptr->account()->capabilities().notificationsAvailable() ) {
             qDebug() << Q_FUNC_INFO << "Account" << ptr->account()->displayName() << "does not have notifications enabled.";
+            deleteLater();
             return;
         }
     }
@@ -55,6 +58,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QVariantMap& jso
 {
     if( statusCode != 200 ) {
         qDebug() << Q_FUNC_INFO << "Notifications failed with status code " << statusCode;
+        deleteLater();
         return;
     }
 

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