Better webengine render process crash handling

This commit is contained in:
Kovid Goyal 2020-02-04 11:26:29 +05:30
parent 72509e53e0
commit 871a3ec922
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -149,13 +149,16 @@ class RestartingWebEngineView(QWebEngineView):
def render_process_terminated(self, termination_type, exit_code):
if termination_type == QWebEnginePage.NormalTerminationStatus:
return
self.webengine_crash_message = 'The Qt WebEngine Render process crashed with termination type: {} and exit code: {}'.format(
termination_type, exit_code)
prints(self.webengine_crash_message)
if self._last_reload_at is not None and monotonic() - self._last_reload_at < 2:
self.render_process_failed.emit()
print('The Qt WebEngine Render process crashed too often')
prints('The Qt WebEngine Render process crashed too often')
else:
self._last_reload_at = monotonic()
self.render_process_restarted.emit()
prints('The Qt WebEngine Render process crashed, restarting it')
prints('Restarting Qt WebEngine')
if __name__ == '__main__':