Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #23410 on branch 6.x (PR: Avoid error in PathComboBox (Widgets)) #23411

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion spyder/widgets/comboboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,16 @@ def focusOutEvent(self, event):
# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
if not self.is_valid():
lineedit = self.lineEdit()
QTimer.singleShot(50, lambda: lineedit.setText(self.selected_text))

# Avoid error when lineedit is no longer available (probably
# because this widget's parent was garbage collected).
# Fixes spyder-ide/spyder#23361
try:
QTimer.singleShot(
50, lambda: lineedit.setText(self.selected_text)
)
except RuntimeError:
pass

hide_status = getattr(self.lineEdit(), 'hide_status_icon', None)
if hide_status:
Expand Down
Loading