File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -700,8 +700,12 @@ def __get__(
700700
701701 # Register callback to connect child events on first connection if requested
702702 if self ._connect_child_events :
703+ try :
704+ ref_ = weakref .ref (instance )
705+ except TypeError :
706+ ref_ = instance # type: ignore
703707 grp ._psygnal_relay ._on_first_connect_callbacks .append (
704- lambda : connect_child_events (instance , recurse = True , _group = grp )
708+ lambda : connect_child_events (ref_ , recurse = True , _group = grp )
705709 )
706710
707711 return self ._instance_map [obj_id ]
@@ -769,6 +773,10 @@ def connect_child_events(
769773 The SignalGroup to connect to. If not provided, will be found by calling
770774 `get_evented_namespace(obj)`. By default None.
771775 """
776+ if isinstance (obj , weakref .ref ):
777+ obj = obj ()
778+ if obj is None :
779+ return # pragma: no cover
772780 if _group is None and (_group := _find_signal_group (obj )) is None :
773781 return # pragma: no cover # not evented
774782
You can’t perform that action at this time.
0 commit comments