From c132f62356207d6d03f4d7569af596210e1ece2b Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Thu, 6 Dec 2018 17:41:20 +0100 Subject: [PATCH] canvas/widgetsscheme: Remove use of QObject.destroyed for logging Use weakref.finalize instead. --- Orange/canvas/scheme/widgetsscheme.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Orange/canvas/scheme/widgetsscheme.py b/Orange/canvas/scheme/widgetsscheme.py index 871a81e1842..5330b103528 100644 --- a/Orange/canvas/scheme/widgetsscheme.py +++ b/Orange/canvas/scheme/widgetsscheme.py @@ -23,6 +23,7 @@ import itertools from collections import namedtuple, deque from urllib.parse import urlencode +from weakref import finalize from typing import List, Tuple import sip @@ -513,11 +514,9 @@ def _delete_widget(self, widget): widget.deleteLater() name = "{} '{}'".format(type(widget).__name__, widget.captionTitle) if log.isEnabledFor(logging.DEBUG): - widget.destroyed.connect( - lambda: log.debug("Destroyed: %s", name)) - widget.__marker = QObject() - widget.__marker.destroyed.connect( - lambda: log.debug("Destroyed namespace: %s", name)) + finalize( + widget, log.debug, "Destroyed namespace: %s", name + ) del self.__widget_processing_state[widget] def create_widget_instance(self, node):