[4.7.6] TQueue Destructor Crash

Hey guys,

I’m experiencing some weird bug here:

I tried putting a TQueue of TSubclasses and have an instance of this in my gamestate and at some other places as well. When closing the editor however, visual studio breaks and tells me about an access violation.

Here is my callstack:

 	UE4Editor-Core.dll!__TBB_machine_cmpswp1()	Unknown
 	UE4Editor-Core.dll!rml::internal::Block::freePublicObject(rml::internal::FreeObject * objectToFree) Line 1149	C++
 	UE4Editor-Core.dll!scalable_free(void * object) Line 2387	C++
>	UE4Editor-Core.dll!FMallocTBB::Free(void * Ptr) Line 115	C++
 	UE4Editor-AIS-4873-Win64-DebugGame.dll!operator delete(void * Ptr) Line 5	C++
 	UE4Editor-AIS-4873-Win64-DebugGame.dll!TQueue<TSubclassOf<AAISShipPawnAI>,1>::~TQueue<TSubclassOf<AAISShipPawnAI>,1>() Line 61	C++
 	[External Code]	
 	UE4Editor-CoreUObject.dll!IncrementalPurgeGarbage(bool bUseTimeLimit, float TimeLimit) Line 983	C++
 	UE4Editor-CoreUObject.dll!StaticExit() Line 3638	C++
 	UE4Editor-CoreUObject.dll!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() Line 921	C++
 	UE4Editor.exe!TBaseMulticastDelegate<void>::Broadcast() Line 1030	C++
 	UE4Editor.exe!FEngineLoop::AppPreExit() Line 2723	C++
 	UE4Editor.exe!FEngineLoop::Exit() Line 2072	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 153	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191	C++
 	[External Code]	

This only occurs on shutting the Editor (so far) though. Any ideas what I did wrong?

Thanks in advance!

PS: I’m working on Windows 8.1 with the binaries

Maybe the output gives some more information ,not sure:

[2015.05.02-13.51.32:172][491]LogExit: Editor shut down
[2015.05.02-13.51.32:173][491]LogExit: Transaction tracking system shut down
[2015.05.02-13.51.32:173][491]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x000000FD47BCF060
[2015.05.02-13.51.32:174][491]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x000000FD5521B6A0
[2015.05.02-13.51.32:174][491]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x000000FD55188720
First-chance exception at 0x00007FF8455B4DB3 (UE4Editor-Core.dll) in UE4Editor.exe: 0xC0000005: Access violation writing location 0x0000000000000010.
Unhandled exception at 0x00007FF8455B4DB3 (UE4Editor-Core.dll) in UE4Editor.exe: 0xC0000005: Access violation writing location 0x0000000000000010.

The program '[7124] UE4Editor.exe' has exited with code 0 (0x0).

No ideas on this ? :confused: I don’t seem to have enough background knowledge to solve this on my own :frowning:
I don’t even use new or any other non-engine-defined mallocs, that could mess up the Free calls …

Hello,

Please note that in terms of Garbage Collection, the only Unreal Engine 4 container that is safe to have UObject or UObject-derived pointers is TArray.
Please also note that for proper functionality in this context every class member should be declared as UPROPERTY().

I would also suggest checking your components in terms of being registered/attached to Root.
If you like to learn more about Garbage Collection in the Engine, please go here:

Hope this helped!

Good luck!

Okay, I didn’t know about this! I hoped for the TQueue to be compatible as well.

I will take a look into that, thank you a lot!

Have a nice day!

EDIT:(The link you wrote there is just this post?)

You are welcome!
You can read the article here:

I does indeed work when using TArray, I was just too focused on using the “better” design choice (TQueue), but yeah … My bad :wink: Thanks a lot :slight_smile: