Fix layout state being saved incorrectly if calibre is killed without a proper shutdown

This commit is contained in:
Kovid Goyal 2012-07-26 11:27:21 +05:30
parent fff1892577
commit 604bae8a45
2 changed files with 4 additions and 1 deletions

View File

@ -135,7 +135,8 @@ class GuiRunner(QObject):
main = Main(self.opts, gui_debug=self.gui_debug)
if self.splash_screen is not None:
self.splash_screen.showMessage(_('Initializing user interface...'))
main.initialize(self.library_path, db, self.listener, self.actions)
with gprefs: # Only write gui.json after initialization is complete
main.initialize(self.library_path, db, self.listener, self.actions)
if self.splash_screen is not None:
self.splash_screen.finish(main)
if DEBUG:

View File

@ -367,6 +367,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
self.keyboard.finalize()
self.auto_adder = AutoAdder(gprefs['auto_add_path'], self)
self.save_layout_state()
# Collect cycles now
gc.collect()