From e4e98c6c235fa5bb67d64dff52aa6f4bf820f3fa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 9 May 2016 09:11:14 +0200 Subject: [PATCH] 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. --- qutebrowser/completion/completiondelegate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qutebrowser/completion/completiondelegate.py b/qutebrowser/completion/completiondelegate.py index 1e00ed04d..167cdb6b8 100644 --- a/qutebrowser/completion/completiondelegate.py +++ b/qutebrowser/completion/completiondelegate.py @@ -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)