Merge branch 'session-autosave' of https://github.com/cosminadrianpopescu/qutebrowser into cosminadrianpopescu-session-autosave

This commit is contained in:
Florian Bruhin 2017-02-20 06:30:34 +01:00
commit cafff3e1b6
2 changed files with 8 additions and 2 deletions

View File

@ -214,14 +214,17 @@ def _load_session(name):
name: The name of the session to load, or None to read state file.
"""
state_config = objreg.get('state-config')
if name is None:
session_manager = objreg.get('session-manager')
if name is None and session_manager.exists('_autosave'):
name = '_autosave'
elif name is None:
try:
name = state_config['general']['session']
except KeyError:
# No session given as argument and none in the session file ->
# start without loading a session
return
session_manager = objreg.get('session-manager')
try:
session_manager.load(name)
except sessions.SessionNotFoundError:
@ -720,6 +723,7 @@ class Quitter:
# Now we can hopefully quit without segfaults
log.destroy.debug("Deferring QApplication::exit...")
objreg.get('signal-handler').deactivate()
objreg.get('session-manager').delete('_autosave')
# We use a singleshot timer to exit here to minimize the likelihood of
# segfaults.
QTimer.singleShot(0, functools.partial(qApp.exit, status))

View File

@ -684,6 +684,8 @@ class AbstractTab(QWidget):
@pyqtSlot(bool)
def _on_load_finished(self, ok):
sess_manager = objreg.get('session-manager')
sess_manager.save('_autosave')
if ok and not self._has_ssl_errors:
if self.url().scheme() == 'https':
self._set_load_status(usertypes.LoadStatus.success_https)