Skip to content

gdbusserver: Keep a strong reference to the server in callbacks

Philip Withnall requested to merge pwithnall/glib:1318-dbus-server-race into master

The on_run() function could be executed in any worker thread from the GThreadedSocketListener, but didn’t previously hold a strong reference to the GDBusServer, which meant the server could be finalised in another thread while on_run() was still running.

This was not ideal.

Hold a strong reference to the GDBusServer while the socket listener is listening, i.e. between every paired call to g_dbus_server_start() and g_dbus_server_stop().

Signed-off-by: Philip Withnall

Closes #1318 (closed)

Merge request reports