diff --git a/src/calibre/gui2/tweak_book/editor/syntax/html.py b/src/calibre/gui2/tweak_book/editor/syntax/html.py index e0296dd5e3..96ce24940e 100644 --- a/src/calibre/gui2/tweak_book/editor/syntax/html.py +++ b/src/calibre/gui2/tweak_book/editor/syntax/html.py @@ -73,6 +73,7 @@ if _speedup is not None: def spell_property(sfmt, locale): s = QTextCharFormat(sfmt) s.setProperty(SPELL_LOCALE_PROPERTY, locale) + s.mem = locale # ensure locale is not garbage collected return s _speedup.init(spell_property, dictionaries.recognized, split_into_words_and_positions) del spell_property