mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-31 01:48:08 +03:00
Fixed thread locking
This commit is contained in:
parent
a0a5fc6ac4
commit
9650bb48b1
@ -204,10 +204,14 @@ def main():
|
||||
if options.profile != None:
|
||||
import hotshot
|
||||
prof = hotshot.Profile(options.profile)
|
||||
gtk.gdk.threads_enter()
|
||||
prof.runcall(gtk.main)
|
||||
gtk.gdk.threads_leave()
|
||||
prof.close()
|
||||
else:
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -58,7 +58,9 @@ class vmmAsyncJob(gobject.GObject):
|
||||
self.topwin.present()
|
||||
self.topwin.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
||||
self.bg_thread.start()
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.gdk.threads_leave()
|
||||
gobject.source_remove(self.timer)
|
||||
self.timer = 0
|
||||
self.topwin.destroy()
|
||||
@ -92,6 +94,13 @@ class vmmAsyncJob(gobject.GObject):
|
||||
self.pbar.set_fraction(1)
|
||||
|
||||
def exit_if_necessary(self):
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
self._exit_if_necessary(self)
|
||||
finally:
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def _exit_if_necessary(self):
|
||||
if self.bg_thread.isAlive():
|
||||
if(self.is_pulsing):
|
||||
self.pbar.pulse()
|
||||
|
@ -192,8 +192,12 @@ class vmmConsole(gobject.GObject):
|
||||
self.try_login()
|
||||
|
||||
def retry_login(self):
|
||||
self.try_login()
|
||||
return False
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
self.try_login()
|
||||
return False
|
||||
finally:
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def try_login(self, src=None):
|
||||
if self.vm.get_id() == 0:
|
||||
|
@ -116,6 +116,13 @@ class vmmEngine:
|
||||
self.timer = gobject.timeout_add(interval, self.tick)
|
||||
|
||||
def tick(self):
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
self._tick()
|
||||
finally:
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def _tick(self):
|
||||
if self.windowConnect == None and gtk.main_level() > 0 and self.count_visible_windows() == 0:
|
||||
gtk.main_quit()
|
||||
|
||||
|
@ -136,6 +136,13 @@ class GRFBNetworkClient(rfb.RFBNetworkClient, gobject.GObject):
|
||||
self.watch = gobject.io_add_watch(self.sock.fileno(), gobject.IO_IN | gobject.IO_ERR | gobject.IO_HUP, self.handle_io)
|
||||
|
||||
def handle_io(self, src, condition):
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
return self._handle_io(src, condition)
|
||||
finally:
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
def _handle_io(self, src, condition):
|
||||
if self.watch == None:
|
||||
return 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user