From 4cfce952fe5d9a812b5fadcf2f71e9afdbc0aa64 Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Wed, 13 Apr 2011 21:00:45 +0300 Subject: [PATCH] media-export: Properly cancel the file monitor --- .../rygel-media-export-recursive-file-monitor.vala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala b/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala index 65b4469..9925025 100644 --- a/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala +++ b/src/plugins/media-export/rygel-media-export-recursive-file-monitor.vala @@ -30,6 +30,9 @@ public class Rygel.MediaExport.RecursiveFileMonitor : Object { this.cancellable = cancellable; this.monitors = new HashMap (GLib.file_hash, GLib.file_equal); + if (cancellable != null) { + cancellable.cancelled.connect (this.cancel); + } } public void on_monitor_changed (File file, @@ -79,13 +82,11 @@ public class Rygel.MediaExport.RecursiveFileMonitor : Object { } public void cancel () { - if (this.cancellable != null) { - this.cancellable.cancel (); - } else { - foreach (var monitor in this.monitors.values) { - monitor.cancel (); - } + foreach (var monitor in this.monitors.values) { + monitor.cancel (); } + + this.monitors.clear (); } public signal void changed (File file, -- 2.7.4