From c905ee94f09e76db917a684a2fb44d83886475f5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 15 May 2018 11:38:05 +0200 Subject: [PATCH] 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: b1ff82eba5e80e4ef3f16e35372ba933c300be1d --- tools/test-networkmanager-service.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py index 2121bb2b2..fd3c44a0f 100755 --- a/tools/test-networkmanager-service.py +++ b/tools/test-networkmanager-service.py @@ -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()