-
Committer:
Chad Miller
-
Date:
2010-03-29 23:59:17 UTC
-
Revision ID:
chad.miller@canonical.com-20100329235917-1dm6wj181cpbjeba
Since replication takes a long time (and we are not clever enough yet to
replicate asynchronously), all replication is pushed into a subthread so
that don't block DBus server calls on getPort and such.
However, for some GUI libraries, GUI functions are not allowed to be outside
the main execution thread. Violating that causes undefined behavior.
We need access to the keyring data in replication, and 'gnomekeyring' may
try to display an alert to the user, using GUI functions. Doing so from
inside the replication thread, outside the main thread, can cause SEGV
crashes in deep and mysterious parts of Python and libraries it uses.
Now, add a wrapper for those functions that can call GUI functions. First
test what environment we're in and if in a subthread, ask the twisted reactor
to run the target function in the main execution thread and return the values
down to the subthread.