Add more shutdown debugging
This commit is contained in:
parent
109906043e
commit
c9e4f2417d
@ -238,6 +238,7 @@ class QuteBrowser(QApplication):
|
|||||||
logging.debug("maybe_quit called from {}, quit status {}".format(
|
logging.debug("maybe_quit called from {}, quit status {}".format(
|
||||||
sender, self._quit_status))
|
sender, self._quit_status))
|
||||||
if all(self._quit_status.values()):
|
if all(self._quit_status.values()):
|
||||||
|
logging.debug("maybe_quit quitting.")
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
def _python_hacks(self):
|
def _python_hacks(self):
|
||||||
@ -328,7 +329,8 @@ class QuteBrowser(QApplication):
|
|||||||
logging.exception("Could not save window geometry.")
|
logging.exception("Could not save window geometry.")
|
||||||
try:
|
try:
|
||||||
if do_quit:
|
if do_quit:
|
||||||
self.mainwindow.tabs.shutdown_complete.connect(self.quit)
|
self.mainwindow.tabs.shutdown_complete.connect(
|
||||||
|
self._on_tab_shutdown_complete)
|
||||||
else:
|
else:
|
||||||
self.mainwindow.tabs.shutdown_complete.connect(
|
self.mainwindow.tabs.shutdown_complete.connect(
|
||||||
functools.partial(self._maybe_quit, 'shutdown'))
|
functools.partial(self._maybe_quit, 'shutdown'))
|
||||||
@ -350,6 +352,16 @@ class QuteBrowser(QApplication):
|
|||||||
config.state['mainwindow']['w'] = str(rect.width())
|
config.state['mainwindow']['w'] = str(rect.width())
|
||||||
config.state['mainwindow']['h'] = str(rect.height())
|
config.state['mainwindow']['h'] = str(rect.height())
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _on_tab_shutdown_complete(self):
|
||||||
|
"""Quit application after a shutdown.
|
||||||
|
|
||||||
|
Gets called when all tabs finished shutting down after shutdown().
|
||||||
|
|
||||||
|
"""
|
||||||
|
logging.debug("Shutdown complete, quitting.")
|
||||||
|
self.quit()
|
||||||
|
|
||||||
@pyqtSlot(tuple)
|
@pyqtSlot(tuple)
|
||||||
def cmd_handler(self, tpl):
|
def cmd_handler(self, tpl):
|
||||||
"""Handle commands and delegate the specific actions.
|
"""Handle commands and delegate the specific actions.
|
||||||
|
@ -171,9 +171,10 @@ class TabbedBrowser(TabWidget):
|
|||||||
try:
|
try:
|
||||||
self._tabs.remove(tab)
|
self._tabs.remove(tab)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logging.error("tab {} could not be removed from tabs {}.".format(
|
logging.exception("tab {} could not be removed".format(tab))
|
||||||
tab, self._tabs))
|
logging.debug("Tabs after removing: {}".format(self._tabs))
|
||||||
if not self._tabs: # all tabs shut down
|
if not self._tabs: # all tabs shut down
|
||||||
|
logging.debug("Tab shutdown complete.")
|
||||||
self.shutdown_complete.emit()
|
self.shutdown_complete.emit()
|
||||||
|
|
||||||
def cur_reload(self, count=None):
|
def cur_reload(self, count=None):
|
||||||
@ -451,12 +452,12 @@ class TabbedBrowser(TabWidget):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
tabcount = self.count()
|
tabcount = self.count()
|
||||||
logging.debug("Shutting down {} tabs...".format(tabcount))
|
|
||||||
if tabcount == 0:
|
if tabcount == 0:
|
||||||
|
logging.debug("No tabs -> shutdown complete")
|
||||||
self.shutdown_complete.emit()
|
self.shutdown_complete.emit()
|
||||||
return
|
return
|
||||||
for tabidx in range(tabcount):
|
for tabidx in range(tabcount):
|
||||||
logging.debug("shutdown {}".format(tabidx))
|
logging.debug("Shutting down tab {}/{}".format(tabidx, tabcount))
|
||||||
tab = self.widget(tabidx)
|
tab = self.widget(tabidx)
|
||||||
tab.shutdown(callback=functools.partial(self._cb_tab_shutdown,
|
tab.shutdown(callback=functools.partial(self._cb_tab_shutdown,
|
||||||
tab))
|
tab))
|
||||||
@ -574,13 +575,18 @@ class BrowserTab(QWebView):
|
|||||||
netman.abort_requests()
|
netman.abort_requests()
|
||||||
netman.destroyed.connect(functools.partial(self.on_destroyed, netman))
|
netman.destroyed.connect(functools.partial(self.on_destroyed, netman))
|
||||||
netman.deleteLater()
|
netman.deleteLater()
|
||||||
logging.debug("Shutdown scheduled")
|
logging.debug("Tab shutdown scheduled")
|
||||||
|
|
||||||
def on_destroyed(self, sender):
|
def on_destroyed(self, sender):
|
||||||
"""Called when a subsystem has been destroyed during shutdown."""
|
"""Called when a subsystem has been destroyed during shutdown."""
|
||||||
self._destroyed[sender] = True
|
self._destroyed[sender] = True
|
||||||
|
dbgout = '\n'.join(['{}: {}'.format(k.__class__.__name__, v)
|
||||||
|
for (k, v) in self._destroyed.items()])
|
||||||
|
logging.debug("{} has been destroyed, new status:\n{}".format(
|
||||||
|
sender.__class__.__name__, dbgout))
|
||||||
if all(self._destroyed.values()):
|
if all(self._destroyed.values()):
|
||||||
if self._shutdown_callback is not None:
|
if self._shutdown_callback is not None:
|
||||||
|
logging.debug("Everything destroyed, calling callback")
|
||||||
self._shutdown_callback()
|
self._shutdown_callback()
|
||||||
|
|
||||||
def eventFilter(self, watched, e):
|
def eventFilter(self, watched, e):
|
||||||
|
Loading…
Reference in New Issue
Block a user