From: Jens Georg Date: Wed, 13 Apr 2011 18:00:45 +0000 (+0300) Subject: media-export: Properly cancel the file monitor X-Git-Tag: RYGEL_0_10_0~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cfce952fe5d9a812b5fadcf2f71e9afdbc0aa64;p=profile%2Fivi%2Frygel.git media-export: Properly cancel the file monitor --- 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,