I am developing UserWidget which expands UCanvasPanel
class INVENTORY_API UInventoryPanel : public UCanvasPanel
{
private:
UItemSlot *DemoSlot;
}
So, I am trying to add to this canvas some item slots from my UUserWidget UItemSlot
void UInventoryPanel::generateSlots()
{
DemoSlot = CreateWidget<UItemSlot>(this, UItemSlot::StaticClass());
UCanvasPanelSlot* CanvasSlot = AddChildToCanvas(DemoSlot);
}
After CreatingWidget I recieve next exception in logs:
ogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: ParentUserWidget && ParentUserWidget->WidgetTree [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/UMG/Private/UserWidget.cpp] [Line: 2075]
LogOutputDevice: Error: Stack:
LogOutputDevice: Error: [Callstack] 0x00007ffd23c2e349 UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd23ae048f UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd0d4028d2 UE4Editor-Inventory.dll!CreateWidget<UItemSlot,UInventoryPanel>() [d:\programs\ue_24\ue_4.25\engine\source\runtime\umg\public\blueprint\userwidget.h:1435]
LogOutputDevice: Error: [Callstack] 0x00007ffd0d40b1f3 UE4Editor-Inventory.dll!UInventoryPanel::SynchronizeProperties() [d:\projects\cppplugins\plugins\inventory\source\inventory\widgets\inventorypanel.cpp:51]
LogOutputDevice: Error: [Callstack] 0x00007ffd23b8617e UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd23ac282f UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd23b32b40 UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd23ab91fc UE4Editor-UMG.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd1409ba89 UE4Editor-UMGEditor.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd1408662e UE4Editor-UMGEditor.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd4b262005 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd4b241af5 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd4b2c6730 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd4b2afdeb UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd4b2a210a UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd93487def UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd93475c87 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd9348a619 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd934717d0 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffdaebde858 USER32.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffdaebde299 USER32.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffd9348bb34 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7f1aa68c4 UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7f1abba7c UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7f1abbb5a UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7f1ace31d UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7f1ad145a UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffdae247034 KERNEL32.DLL!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffdaf362651 ntdll.dll!UnknownFunction []
And the engine crashes with next exception
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000310
UE4Editor_Engine
UE4Editor_Inventory!UItemSlot::RebuildWidget() [d:\projects\cppplugins\plugins\inventory\source\inventory\widgets\itemslot.cpp:13]
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMG
UE4Editor_UMGEditor
UE4Editor_UMGEditor
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll
How can I fix this problem?