From 3491ce5d0a292c2aa2f04dadd4cd2726e9eb84af Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Fri, 16 Mar 2018 13:45:31 +0100 Subject: [PATCH] domaineditor: Give the VarTableModel a parent Fix a memory leak keeping the OWFile instance (and its loaded data) from being garbage collected. --- Orange/widgets/utils/domaineditor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Orange/widgets/utils/domaineditor.py b/Orange/widgets/utils/domaineditor.py index be92ce3ab4b..c9f013e5bdc 100644 --- a/Orange/widgets/utils/domaineditor.py +++ b/Orange/widgets/utils/domaineditor.py @@ -40,8 +40,8 @@ class VarTableModel(QAbstractTableModel): name2type = dict(zip(typenames, vartypes)) type2name = dict(zip(vartypes, typenames)) - def __init__(self, variables): - super().__init__() + def __init__(self, variables, *args): + super().__init__(*args) self.variables = variables def set_variables(self, variables): @@ -186,7 +186,8 @@ def __init__(self, widget): widget.contextOpened.connect(lambda: self.model().set_variables(self.variables)) widget.contextClosed.connect(lambda: self.model().set_variables([])) - self.setModel(VarTableModel(self.variables)) + self.setModel(VarTableModel(self.variables, self)) + self.setSelectionMode(QTableView.NoSelection) self.horizontalHeader().setStretchLastSection(True) self.setShowGrid(False)