fix #6346: quit loop only when the original process is terminated

This commit is contained in:
Neowutran 2021-04-29 19:23:10 +02:00
parent 6b959262f8
commit b1d8302b2b
No known key found for this signature in database
GPG Key ID: 0150AFFAFF83288F

View File

@ -68,7 +68,9 @@ def pid_callback(launcher, pid, pid_list):
pid_list.append(pid) pid_list.append(pid)
def dbus_name_change(loop, name, old_owner, new_owner): def dbus_name_change(loop, service_id, name, old_owner, new_owner):
if name != service_id:
return
if not new_owner: if not new_owner:
loop.quit() loop.quit()
@ -94,11 +96,8 @@ def launch(filename, *files, **kwargs):
try: try:
proxy = bus.get_object(service_id, object_path) proxy = bus.get_object(service_id, object_path)
match = bus.add_signal_receiver( match = bus.add_signal_receiver(
functools.partial(dbus_name_change, loop), functools.partial(dbus_name_change, loop, service_id),
'NameOwnerChanged', 'NameOwnerChanged')
dbus.BUS_DAEMON_IFACE,
dbus.BUS_DAEMON_NAME,
dbus.BUS_DAEMON_PATH)
if files: if files:
proxy.Open(files, {}, proxy.Open(files, {},
dbus_interface='org.freedesktop.Application') dbus_interface='org.freedesktop.Application')