[gnome-settings-daemon] smartcard: detect explicit cancelation explicitly



commit 69649f5916fb371665880f1b4fa60b49672c069b
Author: Ray Strode <rstrode redhat com>
Date:   Mon Feb 10 12:33:21 2014 -0500

    smartcard: detect explicit cancelation explicitly
    
    If the the smartcard function has been cancelled (because,
    say, g-s-d is shutting down), handle that case explicitly,
    so the right error message is propagated.

 plugins/smartcard/gsd-smartcard-manager.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index a416770..5601d84 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -181,6 +181,11 @@ watch_one_event_from_driver (GsdSmartcardManager       *self,
 
         g_cancellable_disconnect (cancellable, handler_id);
 
+        if (g_cancellable_is_cancelled (cancellable)) {
+                g_warning ("smartcard event function cancelled");
+                return FALSE;
+        }
+
         if (card == NULL) {
                 int error_code;
 
@@ -264,6 +269,10 @@ watch_smartcards_from_driver (GTask                    *task,
 
                 watch_succeeded = watch_one_event_from_driver (self, operation, cancellable, &error);
 
+                if (g_task_return_error_if_cancelled (task)) {
+                        break;
+                }
+
                 if (!watch_succeeded) {
                         g_task_return_error (task, error);
                         break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]