Fix error in clearing squeezed boxes,
@@ -1470,13 +1470,16 @@ class BaseShellText(EnhancedTextWithLogging, SyntaxText):
def _clear_content(self, cut_idx):
proposed_cut_float = float(cut_idx)
for btn in list(self._squeeze_buttons):
- btn_pos = float(self.index(btn))
- if btn_pos < proposed_cut_float:
+ idx = self.index(btn)
+ if idx is None or float(idx) < proposed_cut_float:
self._squeeze_buttons.remove(btn)
# looks like the widgets are not fully GC-d.
# At least avoid leaking big chunks of texts
+ try:
btn.contained_text = None
btn.destroy()
+ except:
+ logger.warning("Could not destroy a squeeze button")
self.direct_delete("0.1", cut_idx)
