~cmiller/desktopcouch/retry-on-couchdb-death-bug530541

Viewing all changes in revision 143.

  • Committer: Tarmac
  • Author(s): Chad Miller
  • Date: 2010-03-30 20:06:39 UTC
  • mfrom: (142.1.1 segv-ya-rly)
  • Revision ID: cmiller@hypatia-20100330200639-edchgcdpmm3gwwmu
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 we 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.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: