Skip to content

Commit

Permalink
Widgets: Avoid error in PathComboBox
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Jan 4, 2025
1 parent 3ddbb71 commit bf3b05b
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 bf3b05b

Please sign in to comment.