View Issue Details

IDProjectCategoryView StatusLast Update
0002649NoesisGUIUnrealpublic2023-09-06 13:46
Reporterhcpizzi Assigned Tohcpizzi  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.1 
Target Version3.2.2Fixed in Version3.2.2 
Summary0002649: Crash when multiple delegates are used
DescriptionWhen multiple delegates are used in the same object there's a crash in DataEventTrigger::UnregisterEvent with the following stack:

[Inlined] Noesis::Delegate<void __cdecl(Noesis::BaseComponent *,Noesis::EventArgs const &)>::Remove(const Noesis::Delegate<void __cdecl(Noesis::BaseComponent *,Noesis::EventArgs const &)> &) Delegate.inl:154
[Inlined] Noesis::Delegate<void __cdecl(Noesis::BaseComponent *,Noesis::EventArgs const &)>::operator-=(const Noesis::Delegate<void __cdecl(Noesis::BaseComponent *,Noesis::EventArgs const &)> &) Delegate.inl:160
NoesisApp::DataEventTrigger::UnregisterEvent() DataEventTrigger.cpp:101
[Inlined] NoesisApp::DataEventTrigger::StaticFillClassType::__l2::<lambda_c59d3410317593f84bf83ddc37dcc710>::operator()(Noesis::DependencyObject *,const Noesis::DependencyPropertyChangedEventArgs &) DataEventTrigger.cpp:124
Noesis::Delegate<void __cdecl(Noesis::DependencyObject *,Noesis::DependencyPropertyChangedEventArgs const &)>::FunctorStub<<lambda_c59d3410317593f84bf83ddc37dcc710> >::Invoke(Noesis::DependencyObject *,const Noesis::DependencyPropertyChangedEventArgs &) Delegate.inl:431
[...]
[Inlined] Noesis::Ptr<Noesis::IView>::Reset() Ptr.inl:156
UNoesisInstance::TermInstance() NoesisInstance.cpp:1098
UNoesisInstance::NativeDestruct() NoesisInstance.cpp:1771
[...]
TagsNo tags attached.
PlatformAny

Activities

hcpizzi

hcpizzi

2023-07-13 19:15

developer   ~0008605

Here's a patch that should fix this issue. Could you let us know if it fixes it for you?
2649.patch (983 bytes)   
Index: Source/NoesisRuntime/Private/NoesisTypeClass.cpp
===================================================================
--- Source/NoesisRuntime/Private/NoesisTypeClass.cpp	(revision 12615)
+++ Source/NoesisRuntime/Private/NoesisTypeClass.cpp	(revision 12616)
@@ -2148,6 +2148,11 @@
 	{
 		ObjectMap.Remove(Object);
 	}
+
+	for (auto Pairs : EventMap)
+	{
+		check(Pairs.Value.Empty());
+	}
 }
 
 class NoesisMaterialWrapper
@@ -2503,6 +2508,21 @@
 		return nullptr;
 	}
 
+	auto CountEvents = [](const Noesis::TypeClass* TypeClass)
+	{
+		int32 Count = 0;
+		do
+		{
+			Count += (int32)TypeClass->GetNumEvents();
+			TypeClass = TypeClass->GetBase();
+		} while (TypeClass != nullptr);
+		return Count;
+	};
+
+	const Noesis::TypeClass* TypeClass = Wrapper->GetClassType();
+	int32 EventCount = CountEvents(TypeClass);
+	Wrapper->EventMap.Reserve(EventCount);
+
 	auto Found = Wrapper->EventMap.Find(Property);
 	if (Found == nullptr)
 	{
2649.patch (983 bytes)   

Issue History

Date Modified Username Field Change
2023-07-12 09:22 hcpizzi New Issue
2023-07-12 09:22 hcpizzi Assigned To => hcpizzi
2023-07-12 09:22 hcpizzi Status new => assigned
2023-07-12 11:05 sfernandez Product Version => 3.2.1
2023-07-12 11:05 sfernandez Target Version => 3.2.2
2023-07-13 19:15 hcpizzi Note Added: 0008605
2023-07-13 19:15 hcpizzi File Added: 2649.patch
2023-07-13 21:00 jsantos Status assigned => feedback
2023-09-06 13:46 hcpizzi Status feedback => resolved
2023-09-06 13:46 hcpizzi Resolution open => fixed
2023-09-06 13:46 hcpizzi Fixed in Version => 3.2.2