Widget Garbage Collection

Hi,

My actor has a WidgetComponent, and the widget blueprint is ‘BPChatBubble’. When the parent actor of the widgetcomponent is destroyed, I get this exception. I’m not too sure exactly why its happening because as far as I can tell, the 2 reasons supposed in the error don’t apply to my situation. Any help would be appreciated.


[2018.08.10-14.15.55:622][695]LogOutputDevice: Error: === Handled ensure: ===
[2018.08.10-14.15.55:622][695]LogOutputDevice: Error: 
[2018.08.10-14.15.55:622][695]LogOutputDevice: Error: Ensure condition failed: !IsGarbageCollecting() [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\UMG\Private\Slate\SObjectWidget.cpp] [Line: 41]
[2018.08.10-14.15.55:622][695]LogOutputDevice: Error: SObjectWidget for 'BPChatBubble_C /Engine/Transient.UnrealEdEngine_0:GameInstance_0.BPChatBubble_C_1' destroyed while collecting garbage.  This can lead to multiple GCs being required to cleanup the object.  Possible causes might be,
[2018.08.10-14.15.55:623][695]LogOutputDevice: Error: 1) ReleaseSlateResources not being implemented for the owner of this pointer.
[2018.08.10-14.15.55:623][695]LogOutputDevice: Error: 2) You may just be holding onto some slate pointers on an actor that don't get reset until the actor is Garbage Collected.  You should avoid doing this, and instead reset those references when the actor is Destroyed.
[2018.08.10-14.15.55:624][695]LogOutputDevice: Error: Stack: 
[2018.08.10-14.15.55:624][695]LogOutputDevice: Error: [Callstack] 0x00007fff9dac7136 UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump() [d:\build\++ue4\sync\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:235]
[2018.08.10-14.15.55:624][695]LogOutputDevice: Error: [Callstack] 0x00007fff9d800c82 UE4Editor-Core.dll!FDebug::EnsureFailed() [d:\build\++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:305]
[2018.08.10-14.15.55:625][695]LogOutputDevice: Error: [Callstack] 0x00007fff9d81b346 UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalseImpl() [d:\build\++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:439]
[2018.08.10-14.15.55:625][695]LogOutputDevice: Error: [Callstack] 0x00007fffa18c9a63 UE4Editor-UMG.dll!SObjectWidget::~SObjectWidget() [d:\build\++ue4\sync\engine\source\runtime\umg\private\slate\sobjectwidget.cpp:41]
[2018.08.10-14.15.55:625][695]LogOutputDevice: Error: [Callstack] 0x00007fffb43af32a UE4Editor-SlateCore.dll!FSlotBase::~FSlotBase() [d:\build\++ue4\sync\engine\source\runtime\slatecore\private\slotbase.cpp:77]
[2018.08.10-14.15.55:626][695]LogOutputDevice: Error: [Callstack] 0x00007fff9d0f755a UE4Editor-Slate.dll!SBox::~SBox() ]
[2018.08.10-14.15.55:626][695]LogOutputDevice: Error: [Callstack] 0x00007fffa18c756b UE4Editor-UMG.dll!SWorldWidgetScreenLayer::FComponentEntry::~FComponentEntry() ]
[2018.08.10-14.15.55:626][695]LogOutputDevice: Error: [Callstack] 0x00007fffa1993de0 UE4Editor-UMG.dll!TSet<TTuple<USceneComponent * __ptr64,SWorldWidgetScreenLayer::FComponentEntry>,TDefaultMapHashableKeyFuncs<USceneComponent * __ptr64,SWorldWidgetScreenLayer::FComponentEntry,0>,FDefaultSetAllocator>::Remove() [d:\build\++ue4\sync\engine\source\runtime\core\public\containers\set.h:702]
[2018.08.10-14.15.55:627][695]LogOutputDevice: Error: [Callstack] 0x00007fffa1997ef6 UE4Editor-UMG.dll!SWorldWidgetScreenLayer::RemoveComponent() [d:\build\++ue4\sync\engine\source\runtime\umg\private\slate\sworldwidgetscreenlayer.cpp:69]
[2018.08.10-14.15.55:627][695]LogOutputDevice: Error: [Callstack] 0x00007fffa1999687 UE4Editor-UMG.dll!UWidgetComponent::RemoveWidgetFromScreen() [d:\build\++ue4\sync\engine\source\runtime\umg\private\components\widgetcomponent.cpp:1112]
[2018.08.10-14.15.55:628][695]LogOutputDevice: Error: [Callstack] 0x00007fffa19918b8 UE4Editor-UMG.dll!UWidgetComponent::ReleaseResources() [d:\build\++ue4\sync\engine\source\runtime\umg\private\components\widgetcomponent.cpp:873]
[2018.08.10-14.15.55:628][695]LogOutputDevice: Error: [Callstack] 0x00007fffa191c928 UE4Editor-UMG.dll!UWidgetComponent::EndPlay() [d:\build\++ue4\sync\engine\source\runtime\umg\private\components\widgetcomponent.cpp:614]
[2018.08.10-14.15.55:629][695]LogOutputDevice: Error: [Callstack] 0x00007fff9868203f UE4Editor-Engine.dll!UActorComponent::BeginDestroy() [d:\build\++ue4\sync\engine\source\runtime\engine\private\components\actorcomponent.cpp:449]
[2018.08.10-14.15.55:629][695]LogOutputDevice: Error: [Callstack] 0x00007fff9874a4cc UE4Editor-Engine.dll!UPrimitiveComponent::BeginDestroy() [d:\build\++ue4\sync\engine\source\runtime\engine\private\components\primitivecomponent.cpp:1187]
[2018.08.10-14.15.55:630][695]LogOutputDevice: Error: [Callstack] 0x00007fffa58f2591 UE4Editor-CoreUObject.dll!UObject::ConditionalBeginDestroy() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\obj.cpp:934]
[2018.08.10-14.15.55:630][695]LogOutputDevice: Error: [Callstack] 0x00007fffa58c702e UE4Editor-CoreUObject.dll!UnhashUnreachableObjects() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1625]
[2018.08.10-14.15.55:630][695]LogOutputDevice: Error: [Callstack] 0x00007fffa5880840 UE4Editor-CoreUObject.dll!IncrementalPurgeGarbage() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1071]
[2018.08.10-14.15.55:631][695]LogOutputDevice: Error: [Callstack] 0x00007fffa5843a49 UE4Editor-CoreUObject.dll!CollectGarbageInternal() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1588]
[2018.08.10-14.15.55:631][695]LogOutputDevice: Error: [Callstack] 0x00007fffa58c6d35 UE4Editor-CoreUObject.dll!TryCollectGarbage() [d:\build\++ue4\sync\engine\source\runtime\coreuobject\private\uobject\garbagecollection.cpp:1680]
[2018.08.10-14.15.55:632][695]LogOutputDevice: Error: [Callstack] 0x00007fff9954851c UE4Editor-Engine.dll!UEngine::PerformGarbageCollectionAndCleanupActors() [d:\build\++ue4\sync\engine\source\runtime\engine\private\unrealengine.cpp:1193]
[2018.08.10-14.15.55:632][695]LogOutputDevice: Error: [Callstack] 0x00007fff994d740e UE4Editor-Engine.dll!UEngine::ConditionalCollectGarbage() [d:\build\++ue4\sync\engine\source\runtime\engine\private\unrealengine.cpp:1167]
[2018.08.10-14.15.55:632][695]LogOutputDevice: Error: [Callstack] 0x00007fff98c76157 UE4Editor-Engine.dll!UWorld::Tick() [d:\build\++ue4\sync\engine\source\runtime\engine\private\leveltick.cpp:1640]
[2018.08.10-14.15.55:632][695]LogOutputDevice: Error: [Callstack] 0x00007fff948165ea UE4Editor-UnrealEd.dll!UEditorEngine::Tick() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\editorengine.cpp:1508]
[2018.08.10-14.15.55:633][695]LogOutputDevice: Error: [Callstack] 0x00007fff9510f0d6 UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
[2018.08.10-14.15.55:633][695]LogOutputDevice: Error: [Callstack] 0x00007ff734035cbd UE4Editor.exe!FEngineLoop::Tick() [d:\build\++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3495]
[2018.08.10-14.15.55:633][695]LogOutputDevice: Error: [Callstack] 0x00007ff734045b3c UE4Editor.exe!GuardedMain() [d:\build\++ue4\sync\engine\source\runtime\launch\private\launch.cpp:166]
[2018.08.10-14.15.55:633][695]LogOutputDevice: Error: [Callstack] 0x00007ff734045bba UE4Editor.exe!GuardedMainWrapper() [d:\build\++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:144]
[2018.08.10-14.15.55:634][695]LogOutputDevice: Error: [Callstack] 0x00007ff734053dac UE4Editor.exe!WinMain() [d:\build\++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:223]
[2018.08.10-14.15.55:634][695]LogOutputDevice: Error: [Callstack] 0x00007ff734055aaa UE4Editor.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
[2018.08.10-14.15.55:635][695]LogOutputDevice: Error: [Callstack] 0x00007fffdd3b3034 KERNEL32.DLL!UnknownFunction ]
[2018.08.10-14.15.55:635][695]LogOutputDevice: Error: [Callstack] 0x00007fffdf461431 ntdll.dll!UnknownFunction ]

How are you adding the widget? Is it stored in a variable somewhere, how is it declared?

Is your actor missing a super call in it’s EndPlay method? I’ve had this happen for that reason before.