[baobab/add-notification: 2/3] window: Always disconnect scanner signal handler



commit 143c38eb65866f417e5f7d11dffd9bc9a0ab1dfe
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Wed Oct 10 15:47:24 2018 +0200

    window: Always disconnect scanner signal handler

 src/baobab-window.vala | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 345aac8..74de8f2 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -548,14 +548,15 @@ namespace Baobab {
             var scanner = active_location.scanner;
 
             scan_completed_handler = scanner.completed.connect(() => {
+                if (scan_completed_handler > 0) {
+                    scanner.disconnect (scan_completed_handler);
+                    scan_completed_handler = 0;
+                }
+
                 try {
                     scanner.finish();
                 } catch (IOError.CANCELLED e) {
                     // Handle cancellation silently
-                    if (scan_completed_handler > 0) {
-                        scanner.disconnect (scan_completed_handler);
-                        scan_completed_handler = 0;
-                    }
                     return;
                 } catch (Error e) {
                     Gtk.TreeIter iter;


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