def display_faulthandler(self): """If there was data in the crash log file, display a dialog.""" assert not self._args.no_err_windows if self._crash_log_data: # Crashlog exists and has data in it, so something crashed # previously. self._crash_dialog = crashdialog.FatalCrashDialog( self._args.debug, self._crash_log_data) self._crash_dialog.show() self._crash_log_data = None
def handle_segfault(self): """Handle a segfault from a previous run.""" logname = os.path.join(standarddir.data(), 'crash.log') try: # First check if an old logfile exists. if os.path.exists(logname): with open(logname, 'r', encoding='ascii') as f: data = f.read() os.remove(logname) self._init_crashlogfile() if data: # Crashlog exists and has data in it, so something crashed # previously. self._crash_dialog = crashdialog.FatalCrashDialog( self._args.debug, data) self._crash_dialog.show() else: # There's no log file, so we can use this to display crashes to # the user on the next start. self._init_crashlogfile() except OSError: log.init.exception("Error while handling crash log file!") self._init_crashlogfile()