Preferences freeze for 3-4 seconds when opened with TypeError in keybinding filter#1088
Draft
thiagobraga wants to merge 1 commit into
Draft
Conversation
When a keybinding in the merged config dict has a value of None (e.g. an unbound plugin action overridden by main config), data[act] returns None instead of a string. Using data.get(act) or '' ensures keys is always a string, preventing 'TypeError: object of type NoneType has no len()' that caused Preferences to freeze for 3-4 seconds on open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps to reproduce
Observed behavior
The Preferences window takes 3-4 seconds to appear. The following error is logged to syslog:
Root cause
In
terminatorlib/prefseditor.py:filter_visible(), when a keybinding exists in the merged config dict but its value is None (which happens when a plugin registers a keybinding and the main config overrides it with an unbound/null value), data[act] returns None. The code then calls len(None), raising TypeError.GTK's TreeModelFilter likely swallows the exception but the overhead of repeatedly hitting this error for every row causes the multi-second freeze.
Fix
Changed data[act] if act in data else "" → data.get(act) or "", ensuring keys is always a string regardless of whether the dict value is None, missing, or empty.