[preview] Dont crash on errors in other threads
This commit is contained in:
@@ -379,12 +379,12 @@ class Base(object):
|
|||||||
width, height, GdkPixbuf.InterpType.BILINEAR)
|
width, height, GdkPixbuf.InterpType.BILINEAR)
|
||||||
thumbnail.savev(thumbpath, 'png', [], [])
|
thumbnail.savev(thumbpath, 'png', [], [])
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
dialogs.ErrorDialog(
|
GLib.idle_add(
|
||||||
|
self._raise_error_dialog,
|
||||||
_('Could not save file'),
|
_('Could not save file'),
|
||||||
_('Exception raised while saving thumbnail '
|
_('Exception raised while saving thumbnail '
|
||||||
'for image file (see error log for more '
|
'for image file (see error log for more '
|
||||||
'information)'),
|
'information)'))
|
||||||
transient_for=app.app.get_active_window())
|
|
||||||
log.exception(error)
|
log.exception(error)
|
||||||
return
|
return
|
||||||
return thumbnail
|
return thumbnail
|
||||||
@@ -545,11 +545,11 @@ class Base(object):
|
|||||||
# Write file to harddisk
|
# Write file to harddisk
|
||||||
self._write_file(filepath, mem)
|
self._write_file(filepath, mem)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
dialogs.ErrorDialog(
|
GLib.idle_add(
|
||||||
|
self._raise_error_dialog,
|
||||||
_('Could not save file'),
|
_('Could not save file'),
|
||||||
_('Exception raised while saving image file'
|
_('Exception raised while saving image file'
|
||||||
' (see error log for more information)'),
|
' (see error log for more information)'))
|
||||||
transient_for=app.app.get_active_window())
|
|
||||||
log.error(str(e))
|
log.error(str(e))
|
||||||
|
|
||||||
# Create thumbnail, write it to harddisk and return it
|
# 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(None, None, None, event.button, event.time)
|
||||||
menu.popup_at_pointer(event)
|
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):
|
def disconnect_from_chat_control(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user