summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2024-02-09 14:12:00 +1300
committertoofar <toofar@spalge.com>2024-02-09 14:47:11 +1300
commit810088ed69c8e5eed92a260a208db61d1b48f7ac (patch)
tree8ae07a5aaa566aa9233f1def748fefa98879ada1
parentcfaff206ea8cc1c369b2bd9c0d525c9933b80ff2 (diff)
downloadqutebrowser-810088ed69c8e5eed92a260a208db61d1b48f7ac.tar.gz
qutebrowser-810088ed69c8e5eed92a260a208db61d1b48f7ac.zip
Fix another possible tree and widget desync while loading a session
In 3ec2000b2f1c I identified a few cases where we could be asked to call into the tree structure based on a widget index with evidence that the tree and widget where out of sync. In particular where there were a different amount of items in each. Previously I had ignored desyncs during session loads but now I've found a case where the desync remains after the session was loaded, for a short time. It can be reproduced (most of the time) with: python3 -m qutebrowser -T -s tabs.tree_tabs true ":open about:blank?1" ":open -tr about:blank?2" ":open -tr about:blank?3" ":tab-focus 2" ":tree-tab-toggle-hide" ":cmd-later 200 session-save foo" ":cmd-later 300 session-load -c foo" This only happens if the last set of tabs we open is a collapsed group. There would have been no update event fired since we set the collapsed attribute. If this issue shows up again a more robust approach might be to not set the collapsed attribute in the loop, but load all the tabs visible then go and set the collapsed attribute on all the nodes that need it and fire an update. I initially reproduced this with the "Load a collapsed subtree" end2end test.
-rw-r--r--qutebrowser/misc/sessions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py
index df3b028f7..35c36f203 100644
--- a/qutebrowser/misc/sessions.py
+++ b/qutebrowser/misc/sessions.py
@@ -554,6 +554,13 @@ class SessionManager(QObject):
child = recursive_load_node(child_uid)
child.parent = root_node
+ # Make sure any collapsed tabs are removed from the widget.
+ # Since we only set the "collapsed" attribute after loading the tab,
+ # and the tree only gets updated in the above loop on tab loads. So if
+ # the last set of tabs we load is a collapsed group this children
+ # won't know they are support to be hidden yet.
+ tabbed_browser.widget.tree_tab_update()
+
return tab_to_focus
def _load_legacy_tree_tabs(self, win, tabbed_browser):