Commit 3881c174 authored by Philipp Hörist's avatar Philipp Hörist

[preview] Dont crash on errors in other threads

parent 3c6698da
......@@ -379,12 +379,12 @@ class Base(object):
width, height, GdkPixbuf.InterpType.BILINEAR)
thumbnail.savev(thumbpath, 'png', [], [])
except Exception as error:
dialogs.ErrorDialog(
GLib.idle_add(
self._raise_error_dialog,
_('Could not save file'),
_('Exception raised while saving thumbnail '
'for image file (see error log for more '
'information)'),
transient_for=app.app.get_active_window())
'information)'))
log.exception(error)
return
return thumbnail
......@@ -545,11 +545,11 @@ class Base(object):
# Write file to harddisk
self._write_file(filepath, mem)
except Exception as e:
dialogs.ErrorDialog(
GLib.idle_add(
self._raise_error_dialog,
_('Could not save file'),
_('Exception raised while saving image file'
' (see error log for more information)'),
transient_for=app.app.get_active_window())
' (see error log for more information)'))
log.error(str(e))
# Create thumbnail, write it to harddisk and return it
......@@ -713,5 +713,12 @@ class Base(object):
# menu.popup(None, None, None, event.button, event.time)
menu.popup_at_pointer(event)
@staticmethod
def _raise_error_dialog(pritext, sectext):
# Used by methods that run in a different thread
dialogs.ErrorDialog(pritext,
sectext,
transient_for=app.app.get_active_window())
def disconnect_from_chat_control(self):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment