@@ -271,7 +271,7 @@ class EventSlot : public Event<E>
271271 NodeId nodeId = castedPtr->GetInputNodeId ();
272272 auto & graphPtr = GetInternals (this ->GetGroup ()).GetGraphPtr ();
273273
274- graphPtr->AddInput (nodeId, [castedPtr, &input] { castedPtr->AddInput (input); });
274+ graphPtr->AddInput (nodeId, [this , castedPtr, &input] { castedPtr->AddInput (SameGroupOrLink ( GetGroup (), input) ); });
275275 }
276276
277277 void RemoveInput (const Event<E>& input)
@@ -284,7 +284,7 @@ class EventSlot : public Event<E>
284284 NodeId nodeId = castedPtr->GetInputNodeId ();
285285 auto & graphPtr = GetInternals (this ->GetGroup ()).GetGraphPtr ();
286286
287- graphPtr->AddInput (nodeId, [castedPtr, &input] { castedPtr->RemoveInput (input); });
287+ graphPtr->AddInput (nodeId, [this , castedPtr, &input] { castedPtr->RemoveInput (SameGroupOrLink ( GetGroup (), input) ); });
288288 }
289289
290290 void RemoveAllInputs ()
@@ -314,28 +314,22 @@ class EventLink : public Event<E>
314314 EventLink (EventLink&&) = default ;
315315 EventLink& operator =(EventLink&&) = default ;
316316
317- // Construct with explicit group
317+ // Construct with group
318318 EventLink (const Group& group, const Event<E>& input) :
319319 EventLink::Event ( REACT_IMPL::CtorTag{ }, GetOrCreateLinkNode(group, input) )
320320 { }
321321
322- ~EventLink ()
323- {
324- auto nodePtr = GetNodePtr ();
325- }
326-
327322protected:
328323 static auto GetOrCreateLinkNode (const Group& group, const Event<E>& input) -> decltype(auto )
329324 {
330325 using REACT_IMPL::EventLinkNode;
331326
332- auto targetGraphPtr = GetInternals (group).GetGraphPtr ();
327+ auto & targetGraphPtr = GetInternals (group).GetGraphPtr ();
328+ auto & linkCache = targetGraphPtr->GetLinkCache ();
333329
334330 void * k1 = GetInternals (input.GetGroup ()).GetGraphPtr ().get ();
335331 void * k2 = GetInternals (input).GetNodePtr ().get ();
336332
337- auto & linkCache = targetGraphPtr->GetLinkCache ();
338-
339333 auto nodePtr = linkCache.LookupOrCreate <EventLinkNode<E>>(
340334 { k1, k2 },
341335 [&]
@@ -495,7 +489,7 @@ static Event<E> SameGroupOrLink(const Group& targetGroup, const Event<E>& dep)
495489 if (dep.GetGroup () == targetGroup)
496490 return dep;
497491 else
498- return EventLink<E>( targetGroup, dep ) ;
492+ return EventLink<E>{ targetGroup, dep } ;
499493}
500494
501495/* ***************************************/ REACT_IMPL_END /* **************************************/
0 commit comments