mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix a crash when editing CSS files caused by a behavior change in Qt 5.13. Fixes #1846760 [ebook editor crashes out when scrolling](https://bugs.launchpad.net/calibre/+bug/1846760)
Apparently, if a QTextFormat.FormatRange object is garbage collected by python it is no longer safe to use a previously stored reference to it QTextFormat object
This commit is contained in:
parent
12485fef82
commit
420b2f65b4
@ -741,12 +741,10 @@ class TextEdit(PlainTextEdit):
|
||||
if r.start <= pos <= r.start + r.length and r.format.property(SYNTAX_PROPERTY):
|
||||
return r
|
||||
|
||||
def syntax_format_for_cursor(self, cursor):
|
||||
return getattr(self.syntax_range_for_cursor(cursor), 'format', None)
|
||||
|
||||
def show_tooltip(self, ev):
|
||||
c = self.cursorForPosition(ev.pos())
|
||||
fmt = self.syntax_format_for_cursor(c)
|
||||
fmt_range = self.syntax_range_for_cursor(c)
|
||||
fmt = getattr(fmt_range, 'format', None)
|
||||
if fmt is not None:
|
||||
tt = unicode_type(fmt.toolTip())
|
||||
if tt:
|
||||
|
Loading…
x
Reference in New Issue
Block a user