Why this Pawn class brokes my projects?

Hi! I’m using Unreal Editor 4.11 for linux now, but this happen in 4.9 as well as in 4.10. I’m very newbie to Unreal and C++ and this problem appears when I’m doing the “On Your Own” part of the countdown official C++ tutorial.

Whenever I put this class on a project and press compile, the editor crashes, and I’m not able to open my project anymore, so I have to create a whole new project. Is there a way to reverse whatever the error of compilation did to my project?

Opening a broken project it gives me this error on the terminal.

Signal 11 caught.
EngineCrashHandler: Signal=11
[2016.02.21-23.17.17:228][  0]LogLinux: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to access memory at address 0x000001b0

[2016.02.21-23.17.17:229][  0]LogLinux: Fatal error!

[Callstack]  03  0x00007f6ae36b6580  CommonLinuxCrashHandler(FGenericCrashContext const&)
[Callstack]  04  0x00007f6aeead15b8  PlatformCrashHandler(int, siginfo_t*, void*)
[Callstack]  05  0x00007f6aef65cd10  /lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10) [0x7f6aef65cd10]
[Callstack]  06  0x00007f6aeaff3e6a  AActor::GetWorldTimerManager() const
[Callstack]  07  0x00007f6a84d25dd6  AMyPawn::AMyPawn()
[Callstack]  08  0x00007f6aee3596b6  UClass::CreateDefaultObject()
[Callstack]  09  0x00007f6aee4f1117  ProcessNewlyLoadedUObjects()
[Callstack]  10  0x000000000043ba84  TBaseStaticDelegateInstance<void ()>::ExecuteIfSafe() const [Runtime/Core/Public/Delegates/Tuple.h, line 93]
[Callstack]  11  0x000000000043b2f5  TBaseMulticastDelegate<void>::Broadcast() const [Runtime/Core/Public/Delegates/DelegateSignatureImpl_Variadics.inl, line 921]
[Callstack]  12  0x00007f6aeebd1e0a  FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&, bool)
[Callstack]  13  0x00007f6ae937c370  FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, FDefaultAllocator> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapKeyFuncs<FName, EModuleLoadResult, false> >&)
[Callstack]  14  0x00007f6ae938ca13  FProjectManager::LoadModulesForProject(ELoadingPhase::Type)
[Callstack]  15  0x000000000043526d  FEngineLoop::LoadStartupModules() [/home/mateo/Documentos/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp, line 2078]
[Callstack]  16  0x00000000004195ee  FEngineLoop::PreInit(wchar_t const*) [/home/mateo/Documentos/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp, line 1551]
[Callstack]  17  0x0000000000429e0f  GuardedMain(wchar_t const*) [/home/mateo/Documentos/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp, line 31]
[Callstack]  18  0x00007f6ae36b70be  CommonLinuxMain(int, char**, int (*)(wchar_t const*))
[Callstack]  19  0x00007f6ae2624a40  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f6ae2624a40]
[Callstack]  20  0x00000000004139d9  /home/mateo/Documentos/UnrealEngine/Engine/Binaries/Linux/UE4Editor(_start+0x29) [0x4139d9]

Header File: https://dl.dropboxusercontent.com/u/105638235/Unreal%20problem/MyPawn.h

Source File: https://dl.dropboxusercontent.com/u/105638235/Unreal%20problem/MyPawn.cpp

PS: I can’t upload .h and .cpp files to the post so I used an external link.

I think, the problem is your creation of a timer in the constructor.

Move the following into beginplay.

GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &AMyPawn::AdvanceTimer, 1.0f, true);

Or do and if check on GetWorld() to insure the world is constructed. I believe your trying to access the world before it’s constructed.

I will try that this and let you know, I assume that it is not normal behaviour that a project gets ruined like this for bad coding, it’s just the linux editor that is in early access, isn’t it?

No this happens in all versions. Calling a nullptr during startup will always crash the editor. Not just you :slight_smile: it’s expected.

Is there a way to fix the project? . Because I’m not able to open it anymore after this crash.

By the way, that was exactly the problem. You were right that sentence has to be in the begin play function. Thank you very much for your help.

Recompile and the editor should open normally. If it’s still crashing you’ll need to post the crash log if the new crash event.

How can I recompile it? I usually did that within the editor with the compile button.

Be sure to use replay instead of making a new answer, for future reference. To recompile open visual studio and Build>Build Solution.

I’m using Linux, any advise? I code on Atom - a lightweight modular IDE- , and compile things within the editor, but as long as the editor doesn’t open my project, I think I’m screw. What should I search on google? because I didn’t find anything yet.