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
This commit is contained in:
Ryan Lortie 2015-03-26 16:29:19 -04:00 committed by Matthias Clasen
parent 16190d2dcd
commit 62e5ee5514

View File

@ -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);