@LuLima (LuLima) posted a new topic, subject "Editor Freeze and Crash when Attempting World->SpawnActor". It read:

   Guys do you know if there are any other setups i must do before spawning a actor in the Level? In my project there are various places that i spawn actors. But in this specific case, everytime this function is called my game Freezes and then crashes. I don't have the slightest idea why. The code is almost the same in every place but in this class that it simply Crashes. Just to understand the class it is a Torpedo that when he explodes he spawns an explosion actor to deal damage. It so simple but it breaks the entire execution.
    
    Please someone help me on this.
    
    Code:
    [code] 
        void ATorpedoTrap8b7c:f320:99b9:690f:4595:cd17:293a:c069xplode()
        {
           //Clear Any Timers
           GetWorldTimerManager().ClearAllTimersForObject(this);
           TorpedoUpdateTimeline.Stop();
        
        
           //Check for a valid world
           UWorld* const World = GetWorld();
           if (World)
           {
              //Set the spawn parameters
              FActorSpawnParameters SpawnParams;
              SpawnParams.Owner = this;
              SpawnParams.Instigator = Instigator;
        
              // Get Actor Location to Spawn
              FVector SpawnLocation = GetActorLocation();
        
              //Set a rotation
              FRotator SpawnRotation = GetActorRotation();
        
              // Spawn the pickup
              AActor* const SpawnedActor = World->SpawnActor(Explosion, SpawnLocation, SpawnRotation, SpawnParams);
        
        
              //Setup the Explosion params
              AExplosion* Explosion = Cast(SpawnedActor);
              if (Explosion) 
              {
                 Explosion->Setup(2.f);
              }
           }
           if (!Destroy())
           {
              //Treat Powerup Failded destruction
              UE_LOG(LogClass, Log, TEXT("Not able to destroy actor"));
           }
        }
    [/code]

To which @Doug_E (Doug E) replied

    Hey LuLima-
    
    Can you post the callstack and log files from the crash for additional information? Also let me know if there is any difference if you remove line 14. If you're able to add a breakpoint to the function above, at what point is the breakpoint triggered?
    
    Cheers
    
    Doug Wilson

After which, @LuLima (LuLima) added

    On the crash report in all the lines of code. my classes that appear are:  
    UE4Editor_BattleSubs_8927!ATorpedoTrap8b7c:f320:99b9:690f:4595:cd17:293a:c069xplode() [d:\unrealprojects\battlesubs\source\battlesubs\torpedotrap.cpp:106]  
    UE4Editor_BattleSubs_8927!ATorpedoTrap8b7c:f320:99b9:690f:4595:cd17:293a:c069xecOverlapBoxBeginOverlap() [d:\unrealprojects\battlesubs\source\battlesubs\torpedotrap.h:14]
    
    On the Saved/logs this shows up like this
    
    [2016.02.17-16.00.29:248][380]LogWindows:Error: === Critical error: ===  
    Fatal error!
    
    [2016.02.17-16.00.29:320][380]LogExit: Executing StaticShutdownAfterError  
    [2016.02.17-16.00.29:322][380]LogOutputDevice:Warning:
    
    Script Stack:  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxBeginOverlap  
    TorpedoTrap.OverlapBoxB… and this repeats like to infinity
    
    Removed line 14 still crashed.
    
    When i placed a breakpoint and tried to follow it never got to the cast… It kept jumping back to params and my location and rotation.

To which @Doug_E (Doug E) replied

    Can you post the callstack and log files in their entirety? If you save the callstack as a text file you should be able to zip both files together and post here. Also, it looks like the crash points to line 106 of the Torpedotrap.cpp file which appears to be the Explode() function, is that correct? Can you identify which line of code is at line 106 in Visual Studio?

To which @LuLima (LuLima) replied

    It is exactly the spawn instruction. But i seem to have found the problem looking at the the crash log created in the saved directory. When i spawn the explosion it is calling the torpedos overlap box infinite times so thats crashing the editor. the weird thing is that it doesn't happen to the other actors that have the same behaviour.
    
    Anywho, I disabled the generate overlap of the torpedo before exploding it and that solved the problem.
    
    thanks for pointing me in the right direction Doug, bless you!

So @Doug_E (Doug E) replied

    I'm glad to hear that you were able to find the solution. To prevent such a crash in the future it would help if you could post your callstack and log files as well as providing the setup for your actor and the reproduction steps that cause the crash.

To which @Doug_E (Doug E) replied

    Hi LuLima,
    
    We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
    
    Thank you.


{'source': 'discourse', 'url': 'https://forums.unrealengine.com/t/editor-freeze-and-crash-when-attempting-world-spawnactor/347796', 'title': 'Editor Freeze and Crash when Attempting World->SpawnActor', 'views': 216, 'has_accepted_answer': True, 'word_count': 686, 'like_count': 0, 'reply_count': 6, 'participant_count': 2, 'posts': 7, 'tags': 'question UE4 CPP bug-report crash', 'author': '@LuLima (LuLima)', 'participants': '@LuLima (LuLima), @Doug_E (Doug E)', 'image_url': [None], 'created_at': '2016-02-17T18:53:10.000Z', 'last_posted_at': '2016-02-24T18:08:51.000Z'}