diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 491fe2e04..ae72add20 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -211,6 +211,7 @@ class Completer(QObject): # FIXME complete searches # https://github.com/qutebrowser/qutebrowser/issues/32 completion.set_model(None) + self._last_completion_func = None return before_cursor, pattern, after_cursor = self._partition() diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 15f317c5a..7ea4edf13 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -269,17 +269,18 @@ class CompletionView(QTreeView): Args: model: The model to use. """ + if self.model() is not None and model is not self.model(): + self.model().deleteLater() + self.selectionModel().deleteLater() + + self.setModel(model) + if model is None: self._active = False self.hide() return - if self.model() is not None: - self.model().deleteLater() - self.selectionModel().deleteLater() - model.setParent(self) - self.setModel(model) self._active = True self._maybe_show()