Garbage collector error causing crash on compile of ANYTHING

Editor will crash on compile of anything, and when I debugged with VS, it outputted this.

[2015.11.02-13.40.12:821][ 49]BlueprintLog: New page: Compile MiniMapFunctions
[2015.11.02-13.40.13:059][ 49]LogUObjectBase:Error: Object flags are invalid or either Class or Outer is misaligned
Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.8\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp] [Line: 366] 
Invalid object in GC: 0x000000430d10e6e8, ReferencingObject: DHCharacter /Script/DistantHome.Default__DHCharacter, ReferencingObjectClass: Class /Script/DistantHome.DHCharacter, Property Name: PrimaryWeapon, Offset: 1584, TokenIndex: 33
UE4Editor.exe has triggered a breakpoint.

Here is the related code:

DHCharacter.cpp,
DHCharacter.h

Hey Dirt113-

There are too many references to other classes from your project for the files you posted to be tested by themselves. If possible could you post the full project to test? Are you able to reproduce the crash in a new project and, if so, what steps were taken to cause the crash? Additionally, can you post the Callstack and the log files from the project’s Saved\Logs folder to provide more information?

Cheers

Could you give me your google account? I can’t release it publicly, but I can share it via Google Drive.

If you’re able to upload the project to google drive, you can send me a private message on the forums with a download link.

Link sent. PM me back if you need more.

I just confirmed that it’s not an asset error, I deleted the Content folder and it still happens

After unzipping the project I received a “Failed to launch editor” error. Attempting to build the project in Visual Studio failed as well. Switching the engine version from 4.8 to 4.9 did not compile either however it did indicate that the SetTimer and ClearTimer function calls in DHCharacter.cpp do not match the function declaration parameter list in TimerManager.h. After checking TimerManager.h in 4.8 source code it appears that ClearTimer requires a single FTimerHandle as the only argument. The first argument for SetTimer needs to be a FTimerHandle as well however your character has a reference to “this” as the first argument. Let me know if these changes have any affect on the project crashing when compiling.

Additionally, I assumed that you were referring to compiling a blueprint or material or something else. Does the crash also occur if you are compiling VS code with the editor open?

Editor will crash occasionally if I try rebuilding in VS while it’s open. But that’s pretty usual.

Also, those methods were deprecated, not invalid so it should work. The only reason I used the deprecated overload was because I have no idea how to define an FTimerHandle. Any help with this?

More info:

  • Editor crashes on exit

  • Cannot compile in-editor assets

  • Always breaks on this line:

    HandleTokenStreamObjectReference(NewObjectsToSerialize, CurrentObject, Object, ReferenceTokenStreamIndex, true);

(GarbageCollection.cpp (758))

Could you provide the callstack and log files from the crash? The callstack can be copied from the Crash Report window that appears after the crash. The log files can be found in the project directory in the Saved\Logs folder. After the crash occurs the most recent log files can be zipped up and attached to the post with the callstack.

Project won’t build/rebuild due to the faulty code.

Please help me with declaring FTimerHandle variables :confused:

And just FYI, nothing is in the crash reporter (such as a call stack or log or anything).

After trying to test the project again I was able to get it to open in 4.7.6. Even without the content folder I did get a crash when attempting to compile a blueprint. I have entered a bug report to investigate the crash (UE-23056) with the information gathered so far.

Cheers

Thanks for the help so far

I’m trying to narrow down the problem by moving the code to a new project section by section

Wish me luck :slight_smile: