x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Tick Causes Crash

As far as I understand, my tick causes crash and I cannot figure out why. Anyone can lead me to the solution?

It ticks about 1 min and crashes. The Tick is in a GameMode.

The Tick Method:

 void ASingleBattleMode::Tick(float DeltaSeconds)
 {
     Super::Tick(DeltaSeconds);
     CurrentState->Tick(DeltaSeconds); // line number 31
     if (CurrentState->IsCompleted()) {
         if (CurrentState->NextState != NULL) {
             CurrentState = CurrentState->NextState;
             CurrentState->GameMode = this;
             CurrentState->Setup();
         }
     }
 }

This is the error I get:

 Access violation - code c0000005 (first/second chance not available)
 
 ""
 
 UE4Editor_HeroMasters_7416!ASingleBattleMode::Tick() [c:\users\erayt\documents\unreal projects\heromasters\source\heromasters\singlebattlemode.cpp:31]
 UE4Editor_Engine!AActor::TickActor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\actor.cpp:730]
 UE4Editor_Engine!FActorTickFunction::ExecuteTick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\actor.cpp:107]
 UE4Editor_Engine!FTickFunctionTask::DoTask() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\ticktaskmanager.cpp:141]
 UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\async\taskgraphinterfaces.h:779]
 UE4Editor_Core!FTaskThread::ProcessTasks() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:539]
 UE4Editor_Core!FTaskThread::ProcessTasksUntilQuit() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:340]
 UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:1140]
 UE4Editor_Engine!FTaskGraphInterface::WaitUntilTaskCompletes() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\async\taskgraphinterfaces.h:212]
 UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\ticktaskmanager.cpp:285]
 UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\ticktaskmanager.cpp:1206]
 UE4Editor_Engine!UWorld::RunTickGroup() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\leveltick.cpp:701]
 UE4Editor_Engine!UWorld::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\engine\private\leveltick.cpp:1150]
 UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\editorengine.cpp:1347]
 UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\editor\unrealed\private\unrealedengine.cpp:361]
 UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launchengineloop.cpp:2427]
 UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\launch.cpp:142]
 UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
 UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
 UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
 kernel32
 ntdll




Product Version: UE 4.10
Tags:
more ▼

asked Dec 30 '15 at 11:56 AM in C++ Programming

avatar image

ErayT
250 36 37 169

avatar image Pierdek Dec 30 '15 at 12:01 PM

Show us code of your tick function and mark 31 line of this code.

avatar image ErayT Dec 30 '15 at 12:23 PM

Updated my question. Is it something that at some point my state is removed by garbage collector or sth?

avatar image Pierdek Dec 30 '15 at 12:39 PM

Yep it seems the CurrentState is gced, you should wrap it with UPROPERTY() macro or use TWeakPtr and check if it is valid before use it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I have added UPROPERTY macro inside my GameMode holding CurrentState so that it is not removed by Garbage Collector of UE.

     UPROPERTY()
     class UBattleState* CurrentState;


More Information: Garbage Collection

In the article it says:

you must have at least 1 reference to the UObject that is UPROPERTY()

Additionally, I would like to thank the user @Pierdek for leading the solution.

more ▼

answered Dec 30 '15 at 12:57 PM

avatar image

ErayT
250 36 37 169

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question