[GTK] Remove running reactor in Gdk thread

The Gdk threading code is causing issue on Windows and this method
of moving the main loop to a thread has been deprecated and advised
against so removing without adding replacement as it currently
only creates one main thread and should still be fine.

If a blocking operation occures and needs solving, see the pygobject
guide for recommened way to use threads in Gtk:

https://pygobject.readthedocs.io/en/latest/guide/threading.html
This commit is contained in:
Calum Lind 2019-03-29 15:06:38 +00:00
parent c8b621172e
commit 84643fb6f7
1 changed files with 1 additions and 9 deletions

View File

@ -22,7 +22,7 @@ gi.require_version('Gtk', '3.0') # NOQA: E402
gi.require_version('Gdk', '3.0') # NOQA: E402
# isort:imports-thirdparty
from gi.repository.Gdk import Display, threads_enter, threads_init, threads_leave
from gi.repository.Gdk import Display
from gi.repository.GLib import set_prgname
from gi.repository.Gtk import Builder, ResponseType
from twisted.internet import defer, gtk3reactor
@ -189,10 +189,6 @@ class GtkUI(object):
self.queuedtorrents = QueuedTorrents()
self.ipcinterface = IPCInterface(args.torrents)
# Since PyGObject 3.10.2, calling GObject.threads_init() this is no longer needed.
# For details on need for threading, see: https://wiki.gnome.org/Projects/PyGObject/Threading
threads_init()
# We make sure that the UI components start once we get a core URI
client.set_disconnect_callback(self.__on_disconnect)
@ -248,13 +244,9 @@ class GtkUI(object):
def start(self):
reactor.callWhenRunning(self._on_reactor_start)
# Initialize gdk threading
threads_enter()
reactor.run()
# Reactor is not running. Any async callbacks (Deferreds) can no longer
# be processed from this point on.
threads_leave()
def shutdown(self, *args, **kwargs):
log.debug('GTKUI shutting down...')