diff --git a/src/silx/gui/hdf5/Hdf5TreeModel.py b/src/silx/gui/hdf5/Hdf5TreeModel.py index fc0f468eb4..8c440ca5d3 100644 --- a/src/silx/gui/hdf5/Hdf5TreeModel.py +++ b/src/silx/gui/hdf5/Hdf5TreeModel.py @@ -29,7 +29,6 @@ import os import logging -import functools from .. import qt from .. import icons from .Hdf5Node import Hdf5Node @@ -243,7 +242,13 @@ def __init__(self, parent=None, ownFiles=True): # while the QObject still exists. # We use a static method plus explicit references to objects to # release. The callback do not use any ref to self. - onDestroy = functools.partial(self._closeFileList, self.__openedFiles) + # onDestroy = functools.partial(self._closeFileList, self.__openedFiles) + def onDestroy(): + try: + self._closeFileList(self.__openedFiles) + except Exception: + pass + self.destroyed.connect(onDestroy) @staticmethod