changed to using an internal _autosave session

This commit is contained in:
Cosmin Popescu 2016-11-07 20:45:46 +01:00
parent 3692c86a7e
commit c590a37043
3 changed files with 8 additions and 10 deletions

View File

@ -210,14 +210,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')
session_manager = objreg.get('session-manager')
if 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
if session_manager.exists('_autosave'):
name = '_autosave'
else:
return
session_manager = objreg.get('session-manager')
try:
session_manager.load(name)
except sessions.SessionNotFoundError:
@ -723,6 +726,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').session_delete('_autosave', force = True)
# We use a singleshot timer to exit here to minimize the likelihood of
# segfaults.
QTimer.singleShot(0, functools.partial(qApp.exit, status))

View File

@ -685,9 +685,8 @@ class AbstractTab(QWidget):
@pyqtSlot(bool)
def _on_load_finished(self, ok):
if config.get('general', 'auto-save-session'):
sess_manager = objreg.get('session-manager')
sess_manager.session_save()
sess_manager.session_save('_autosave', quiet = True, force = True)
if ok and not self._has_ssl_errors:
if self.url().scheme() == 'https':
self._set_load_status(usertypes.LoadStatus.success_https)

View File

@ -160,11 +160,6 @@ def data(readonly=False):
SettingValue(typ.Bool(), 'true'),
"Whether to save the config automatically on quit."),
('auto-save-session',
SettingValue(typ.Bool(), 'false'),
"Whether to save the session automatically when a page finishes "
"loading."),
('auto-save-interval',
SettingValue(typ.Int(minval=0, maxval=MAXVALS['int']), '15000'),
"How often (in milliseconds) to auto-save config/cookies/etc."),