View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002701 | NoesisGUI | Unreal | public | 2023-09-26 14:25 | 2023-09-27 15:30 |
Reporter | vmaurer | Assigned To | hcpizzi | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.2.1 | ||||
Target Version | 3.2.2 | Fixed in Version | 3.2.2 | ||
Summary | 0002701: Crash when closing the application with Alt+F4 | ||||
Description | The application crashes when shut down using Alt+F4. No crash message is generated. A break point in Unreal's material instance code will trigger, if a debugger is attached to the application (See call stack). Without debugger, the process just a remains in a zombie state. A note on the call stack: UVisibilityManagedElement is a custom class with a Noesis::Ptr< Noesis::UIElement > to a tree containing material instances. It seems the materials weren't cleaned up by the plugin when AppPreExit() was called. | ||||
Steps To Reproduce | - During game runtime, a UI with material instances must be added to the viewport - A UObject with a smart pointer to a UIElement within that UI must exist - Hitting Alt+F4 triggers the AppPreExit() function and the garbage collector force destroys the before mentioned UObject with the UIElement pointer. | ||||
Tags | C++, Materials, Unreal | ||||
Platform | Any | ||||
callstack_crash_altf4.txt (3,420 bytes)
<unknown> 0x0000000000000000 GameThread_UpdateMIParameter<FScalarParameterValue>(const UMaterialInstance *,const FScalarParameterValue &) MaterialInstance.cpp:404 UMaterialInstance::SetScalarParameterValueInternal(const FMaterialParameterInfo &,float,bool,FScalarParameterAtlasInstanceData) MaterialInstance.cpp:3494 UMaterialInstanceDynamic::SetScalarParameterValue(FName,float) MaterialInstanceDynamic.cpp:162 Noesis::Delegate<void __cdecl(Noesis::DependencyObject *,Noesis::DependencyPropertyChangedEventArgs const &)>::FunctorStub<<lambda_a74d8113313107b860a377d40aff50f7> >::Invoke(Noesis::DependencyObject *,const Noesis::DependencyPropertyChangedEventArgs &) Delegate.inl:431 <unknown> 0x00007ffcf0e8e114 <unknown> 0x00007ffcf0e90772 <unknown> 0x00007ffcf0e8df36 <unknown> 0x00007ffcf0e8d83f Noesis::ValueStorageManagerImpl<float>::SetValue(Noesis::DependencyObject *,const Noesis::DependencyProperty *,const void *,unsigned char,Noesis::Expression *,const Noesis::PropertyMetadata *,Destination) ValueStorageManagerImpl.inl:230 <unknown> 0x00007ffcf0e8d21e <unknown> 0x00007ffcf0e8ce79 <unknown> 0x00007ffcf0e8d8e9 <unknown> 0x00007ffcf0eae949 <unknown> 0x00007ffcf0f1bb95 <unknown> 0x00007ffcf10178c2 <unknown> 0x00007ffcf1017666 <unknown> 0x00007ffcf10308e0 <unknown> 0x00007ffcf0e8dff1 <unknown> 0x00007ffcf101d406 <unknown> 0x00007ffcf101d335 <unknown> 0x00007ffcf105ad01 <unknown> 0x00007ffcf101766f <unknown> 0x00007ffcf10308e0 <unknown> 0x00007ffcf0e8dff1 <unknown> 0x00007ffcf105ad01 <unknown> 0x00007ffcf101766f <unknown> 0x00007ffcf0e8dff1 <unknown> 0x00007ffcf105ad01 <unknown> 0x00007ffcf101766f <unknown> 0x00007ffcf10308e0 <unknown> 0x00007ffcf0e8dff1 UVisibilityManagedElement::~UVisibilityManagedElement() VisibilityManagedElement.gen.cpp:165 UVisibilityManagedElement::`scalar deleting destructor'(unsigned int) 0x00007ff7b28935a7 [Inlined] FAsyncPurge::TickDestroyObjects(bool,float,double) GarbageCollection.cpp:387 FAsyncPurge::TickPurge(bool,float,double) GarbageCollection.cpp:551 IncrementalDestroyGarbage(bool,double) GarbageCollection.cpp:3759 IncrementalPurgeGarbage(bool,double) GarbageCollection.cpp:3447 StaticExit() Obj.cpp:4942 [Inlined] Invoke(void (*const &)()) Invoke.h:47 [Inlined] UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int> >::ApplyAfter(void (*const &)()) Tuple.h:321 TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() DelegateInstancesImpl.h:656 TMulticastDelegateBase<FDefaultDelegateUserPolicy>::Broadcast<IBaseDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>,TDelegate<void __cdecl(void),FDefaultDelegateUserPolicy> >() MulticastDelegateBase.h:239 [Inlined] TMulticastDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::Broadcast() DelegateSignatureImpl.inl:988 FEngineLoop::AppPreExit() LaunchEngineLoop.cpp:6729 FEngineLoop::Exit() LaunchEngineLoop.cpp:5039 [Inlined] EngineExit() Launch.cpp:72 [Inlined] GuardedMain::__l2::EngineLoopCleanupGuard::{dtor}() Launch.cpp:126 GuardedMain(const wchar_t *) Launch.cpp:202 LaunchWindowsStartup(HINSTANCE__ *,HINSTANCE__ *,char *,int,const wchar_t *) LaunchWindows.cpp:233 WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int) LaunchWindows.cpp:284 [Inlined] invoke_main() 0x00007ff7b6af19a2 __scrt_common_main_seh() 0x00007ff7b6af1981 <unknown> 0x00007ffdb1c6257d <unknown> 0x00007ffdb3b2aa68 |
|
I've changed the raw material pointer to a weak pointer in the material wrapper. I've attached a patch. 2701.patch (1,877 bytes)
Index: NoesisGUI/Source/NoesisRuntime/Private/NoesisTypeClass.cpp =================================================================== --- NoesisGUI/Source/NoesisRuntime/Private/NoesisTypeClass.cpp (revision 12777) +++ NoesisGUI/Source/NoesisRuntime/Private/NoesisTypeClass.cpp (revision 12778) @@ -2171,18 +2171,21 @@ MaterialInstanceDynamic = UMaterialInstanceDynamic::Create(InMaterial, GetTransientPackage()); } MaterialInstanceDynamic->AddToRoot(); - Material = NoesisCreateMaterial(MaterialInstanceDynamic); + Material = NoesisCreateMaterial(MaterialInstanceDynamic.Get()); } virtual ~NoesisMaterialWrapper() { NoesisDestroyMaterial(Material); - MaterialInstanceDynamic->RemoveFromRoot(); + if (MaterialInstanceDynamic.IsValid()) + { + MaterialInstanceDynamic->RemoveFromRoot(); + } } void SetScalarParameterValue(FName ParamName, float Value) { - if (MaterialInstanceDynamic != nullptr) + if (MaterialInstanceDynamic.IsValid()) { MaterialInstanceDynamic->SetScalarParameterValue(ParamName, Value); } @@ -2190,7 +2193,7 @@ void SetVectorParameterValue(FName ParamName, FLinearColor Value) { - if (MaterialInstanceDynamic != nullptr) + if (MaterialInstanceDynamic.IsValid()) { MaterialInstanceDynamic->SetVectorParameterValue(ParamName, Value); } @@ -2198,7 +2201,7 @@ void SetTextureParameterValue(FName ParamName, UTexture* Value) { - if (MaterialInstanceDynamic != nullptr) + if (MaterialInstanceDynamic.IsValid()) { MaterialInstanceDynamic->SetTextureParameterValue(ParamName, Value); } @@ -2207,7 +2210,7 @@ protected: NoesisTypeClass* TypeClass = nullptr; - UMaterialInstanceDynamic* MaterialInstanceDynamic = nullptr; + TWeakObjectPtr<UMaterialInstanceDynamic> MaterialInstanceDynamic; void* Material = nullptr; }; |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2023-09-26 14:25 | vmaurer | New Issue | |
2023-09-26 14:25 | vmaurer | Tag Attached: C++ | |
2023-09-26 14:25 | vmaurer | Tag Attached: Materials | |
2023-09-26 14:25 | vmaurer | Tag Attached: Unreal | |
2023-09-26 14:25 | vmaurer | File Added: callstack_crash_altf4.txt | |
2023-09-27 10:45 | sfernandez | Assigned To | => hcpizzi |
2023-09-27 10:45 | sfernandez | Status | new => assigned |
2023-09-27 10:45 | sfernandez | Target Version | => 3.2.2 |
2023-09-27 15:30 | hcpizzi | Note Added: 0008778 | |
2023-09-27 15:30 | hcpizzi | File Added: 2701.patch | |
2023-09-27 15:30 | hcpizzi | Status | assigned => resolved |
2023-09-27 15:30 | hcpizzi | Resolution | open => fixed |
2023-09-27 15:30 | hcpizzi | Fixed in Version | => 3.2.2 |