Fix a few possible crashes

- TextWidget: avoid crash with small max_width (could happen
  when opening menu on a small emulator window)
- TextWidget: avoid crash if re-used after :free()
- ReaderHighlight:clear(): fix possible crash when
  scheduled and run after document closed
- DictQuickLookup: minor canSearch() tweak ('selected_text'
  is normally available only on multiple words selection,
  but is currently available on single word selection thanks
  to some unrelated side effect)
This commit is contained in:
poire-z
2021-05-19 22:57:46 +02:00
parent 067ece7281
commit 001d48f6cc
3 changed files with 9 additions and 3 deletions

View File

@@ -379,6 +379,10 @@ function ReaderHighlight:clear(clear_id)
end
end
self.clear_id = nil -- invalidate id
if not self.ui.document then
-- might happen if scheduled and run after document is closed
return
end
if self.ui.document.info.has_pages then
self.view.highlight.temp = {}
else