Skip to content

Commit

Permalink
xb-silo: Cancel the GFileMonitor before unreffing it
Browse files Browse the repository at this point in the history
GFileMonitors currently need to be explicitly cancelled when they are
unreffed, otherwise they can deadlock due to the GLib-internal worker
thread also holding a strong reference to the monitor.

For full details, see: https://gitlab.gnome.org/GNOME/glib/-/issues/1941

Closes #59
  • Loading branch information
iainlane authored and hughsie committed Jan 25, 2021
1 parent 5efecd0 commit a137f1a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/xb-silo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ xb_silo_machine_fixup_attr_text_cb (XbMachine *self,
static void
xb_silo_file_monitor_item_free (XbSiloFileMonitorItem *item)
{
g_file_monitor_cancel (item->file_monitor);
g_signal_handler_disconnect (item->file_monitor, item->file_monitor_id);
g_object_unref (item->file_monitor);
g_slice_free (XbSiloFileMonitorItem, item);
Expand Down

0 comments on commit a137f1a

Please sign in to comment.