Commits

Yuya Nishihara committed ff243ef

manifest: bind applyFilter() to instance for ease of lifecycle handling

In some cases, garbage-collector can be blocked by dynamic function/lambda
connected to long-lived signal.

  • Participants
  • Parent commits 8a8cbed

Comments (0)

Files changed (1)

File tortoisehg/hgqt/manifestdialog.py

         self._filterupdatetimer = QTimer(self, interval=200, singleShot=True)
         self.le.returnPressed.connect(self._treeview.expandAll)
         self.le.textChanged.connect(self._filterupdatetimer.start)
-        def applyFilter():
-            filtertext = self.le.text()
-            self._treemodel.setNameFilter(filtertext)
-            self._treeview.enablefilterpalette(filtertext)
+        self._filterupdatetimer.timeout.connect(self._applyFilter)
 
-        self._filterupdatetimer.timeout.connect(
-            applyFilter)
+    @pyqtSlot()
+    def _applyFilter(self):
+        filtertext = self.le.text()
+        self._treemodel.setNameFilter(filtertext)
+        self._treeview.enablefilterpalette(filtertext)
 
     @pyqtSlot()
     def _autoexpandtree(self):