Skip to content

Commit

Permalink
Merge pull request #23410 from ccordoba12/issue-23361
Browse files Browse the repository at this point in the history
PR: Avoid error in `PathComboBox` (Widgets)
  • Loading branch information
ccordoba12 authored Jan 4, 2025
2 parents 5b06eb5 + bf3b05b commit ff3940a
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit ff3940a

Please sign in to comment.