[glib] gpollfilemonitor: don't emit after cancellation



commit 62e5ee5514f0838689bc7d2d2c1a43fa912eaf1a
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Mar 26 16:29:19 2015 -0400

    gpollfilemonitor: don't emit after cancellation
    
    GPollFileMonitor emits CHANGES_DONE_HINT after CHANGED signals, but it
    doesn't check to ensure that the file monitor wasn't cancelled before it
    does that.
    
    If the original signal caused the monitor to be unreffed, cancelled and
    destroyed, we would still end up emitting an extra signal on it.
    
    Avoid that by checking first for cancellation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739424

 gio/gpollfilemonitor.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gio/gpollfilemonitor.c b/gio/gpollfilemonitor.c
index bdc72e3..b1238a3 100644
--- a/gio/gpollfilemonitor.c
+++ b/gio/gpollfilemonitor.c
@@ -131,7 +131,8 @@ got_new_info (GObject      *source_object,
                                     poll_monitor->file,
                                     NULL, event);
          /* We're polling so slowly anyway, so always emit the done hint */
-         if (event == G_FILE_MONITOR_EVENT_CHANGED)
+         if (!g_file_monitor_is_cancelled (G_FILE_MONITOR (poll_monitor)) &&
+             (event == G_FILE_MONITOR_EVENT_CHANGED))
            g_file_monitor_emit_event (G_FILE_MONITOR (poll_monitor),
                                       poll_monitor->file,
                                       NULL, G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT);


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