call gtk.gdk.threads_init() to initialise threads used when en/decrypting GPG. Fixes #4959
This commit is contained in:
parent
e412cd1dfb
commit
5419b2cb36
1 changed files with 14 additions and 13 deletions
27
src/gajim.py
27
src/gajim.py
|
@ -477,19 +477,19 @@ class PassphraseRequest:
|
||||||
self.dialog_created = True
|
self.dialog_created = True
|
||||||
|
|
||||||
|
|
||||||
class ThreadInterface:
|
class ThreadInterface:
|
||||||
def __init__(self, func, func_args, callback, callback_args):
|
def __init__(self, func, func_args, callback, callback_args):
|
||||||
'''Call a function in a thread
|
'''Call a function in a thread
|
||||||
|
|
||||||
:param func: the function to call in the thread
|
:param func: the function to call in the thread
|
||||||
:param func_args: list or arguments for this function
|
:param func_args: list or arguments for this function
|
||||||
:param callback: callback to call once function is finished
|
:param callback: callback to call once function is finished
|
||||||
:param callback_args: list of arguments for this callback
|
:param callback_args: list of arguments for this callback
|
||||||
'''
|
'''
|
||||||
def thread_function(func, func_args, callback, callback_args):
|
def thread_function(func, func_args, callback, callback_args):
|
||||||
output = func(*func_args)
|
output = func(*func_args)
|
||||||
gobject.idle_add(callback, output, *callback_args)
|
gobject.idle_add(callback, output, *callback_args)
|
||||||
Thread(target=thread_function, args=(func, func_args, callback,
|
Thread(target=thread_function, args=(func, func_args, callback,
|
||||||
callback_args)).start()
|
callback_args)).start()
|
||||||
|
|
||||||
class Interface:
|
class Interface:
|
||||||
|
@ -3536,6 +3536,7 @@ if __name__ == '__main__':
|
||||||
Interface()
|
Interface()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
gtk.gdk.threads_init()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print >> sys.stderr, 'KeyboardInterrupt'
|
print >> sys.stderr, 'KeyboardInterrupt'
|
||||||
|
|
Loading…
Add table
Reference in a new issue