tests: fix quitting mainloop in test-networkmanager-service.py

Previously, the callbacks would return gl.mainloop.quit(), which is None
and thus the source got removed already. The later GLib.source_remove()
would thus use an invalid source-id.

Fix that, by no removing the source id from the callback.

Fixes: b1ff82eba5
This commit is contained in:
Thomas Haller
2018-05-15 11:38:05 +02:00
parent d66b277471
commit c905ee94f0

View File

@@ -1392,13 +1392,12 @@ def main():
raise AssertionError("Failure to request D-Bus name org.freedesktop.NetworkManager")
# Watch stdin; if it closes, assume our parent has crashed, and exit
io = GLib.IOChannel(0)
id1 = io.add_watch(GLib.IOCondition.HUP,
lambda io, condition: gl.mainloop.quit())
id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP,
lambda io, condition: gl.mainloop.quit() or True)
# also quit after inactivity to ensure we don't stick around if the above fails somehow
id2 = GLib.timeout_add_seconds(20,
lambda: gl.mainloop.quit())
lambda: gl.mainloop.quit() or True)
gl.mainloop.run()