Backport !2155 “glocalfilemonitor: Avoid a deadlock on finalization” to glib-2-68
requested to merge pwithnall/glib:backport-2155-local-file-monitor-deadlock-glib-2-68 into glib-2-68
If g_file_monitor_source_dispatch()
drops the last reference to its
GLocalFileMonitor
, a deadlock will occur, because disposing the
GLocalFileMonitor
causes synchronous disposal of the
GFileMonitorSource
, and hence an attempt to re-lock the already-locked
mutex in the GFileMonitorSource
.
Fix that by dropping the reference to the GLocalFileMonitor
after
unlocking.
Diagnosed by Ting-Wei Lan. The bug was originally introduced by me in commit 592a13b4.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Trivial backport of !2155 (merged) to glib-2-68
.