code: def commitAndClose(self):
          
          if self.delegate:
              self.delegate.commitData.emit(self)
              self.delegate.closeEditor.emit(self, QtWidgets.QAbstractItemDelegate.NoHint) # CLOSES SELF!
          else:
              # QAbstractItemView.closeEditor is sometimes called directly, without the
              # QAbstractItemDelegate.closeEditor signal begin emitted, e.g when the currentItem
              # changes. Therefore the commitAndClose method can be called twice, if we call it
              # explicitly as well (e.g. in FontCtiEditor.execFontDialog(). We guard against this.
              logger.debug("AbstractCtiEditor.commitAndClose: editor already closed (ignored).")
docs: Commits the data of the sub editor and instructs the delegate to close this ctiEditor.
  
              The delegate will emit the closeEditor signal which is connected to the closeEditor
              method of the ConfigTreeView class. This, in turn will, call the finalize method of
              this object so that signals can be disconnected and resources can be freed. This is
              complicated but I don't see a simpler solution.