Delete QTextDocument properly in completion.
The CompletionItemDelegate gets reused by Qt for various items in the completion. Every time _get_textdoc() was called we created a new QTextDocument, but since it has a long-living parent set (the delegate) the old one was never actually garbage collected. We now explicitly delete the old QTextDocument as it's not needed anymore by either Qt or Python. See #1476.
This commit is contained in:
parent
56f1d885f9
commit
e4e98c6c23
@ -183,6 +183,8 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
||||
text_option.setAlignment(QStyle.visualAlignment(
|
||||
self._opt.direction, self._opt.displayAlignment))
|
||||
|
||||
if self._doc is not None:
|
||||
self._doc.deleteLater()
|
||||
self._doc = QTextDocument(self)
|
||||
self._doc.setDefaultFont(self._opt.font)
|
||||
self._doc.setDefaultTextOption(text_option)
|
||||
|
Loading…
Reference in New Issue
Block a user