Skip to content

Commit 445bc2c

Browse files
committed
glib: destroy the _AuthLineSource explicitly
See https://gitlab.gnome.org/GNOME/pygobject/-/issues/525 for an explanation, the summary is: we need to explicitly call source.destroy() if dispatch returns GLib.SOURCE_REMOVE. Deleting the source by resetting it to None causes invalid memory accesses and eventual crashes. This can be reproduced with a basic call to bus = dbus_next.glib.MessageBus(bus_type=dbus_next.BusType.SESSION).connect_sync() and a GLib.MainLoop() after this call. Run in valgrind --tool=memcheck. Fixes #113
1 parent b74742e commit 445bc2c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dbus_next/glib/message_bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def line_notify(line):
457457
self._stream.write(Authenticator._format_line(resp))
458458
self._stream.flush()
459459
if resp == 'BEGIN':
460-
self._readline_source = None
460+
self._readline_source.destroy()
461461
authenticate_notify(None)
462462
return True
463463
except Exception as e:

0 commit comments

Comments
 (0)