DBusGMainLoop segfaults python if multi-threaded

Bug #1890753 reported by Dan Streetman
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dbus-python (Ubuntu)
New
Undecided
Unassigned

Bug Description

python segfaults if DBusMainLoop is used in multiple threads; e.g.:

#!/usr/bin/python3

import dbus
import sys
import threading

from gi.repository import GLib

from dbus.mainloop.glib import DBusGMainLoop
#DBusGMainLoop(set_as_default=True)

if __name__ == "__main__":
    threading.Thread(target=GLib.MainLoop().run).start()

    for r in range(1000):
        print(".", flush=True, end="")
        dbus.SessionBus(private=True, mainloop=DBusGMainLoop())
        #dbus.SessionBus(private=True)

    print("")
    sys.exit(0)

$ ./test.py
.............Segmentation fault

It will also segfault if set_as_default is set to True, even without passing it to the SessionBus's mainloop parameter.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.