Crash with thinkers on exit

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Crash with thinkers on exit

Post by Major Cooke »

I'm sending a mod out to select developers. Yes, it is a large file, and unfortunately I've not had any luck whatsoever trying to replicate this on its own.
  • Go to map 3SEWER and let the game run for at least a tic.
  • Quit the game.
The game crashes (I'm using Windows 10 so it gives the 'GZDoom.exe has stopped working' crash), making it quite frustrating since any changes to any properties are lost.

However I've narrowed it down to SmileHeartBeat actor inside of ZSuper/Entities/Smile.txt being the culprit. Even after commenting out all of the code involved and leaving the Init function with nothing in it, it still crashes.

Image of the stack trace in VS2015

EDIT: If you "remove Smile" in console, the crash doesn't occur since Smile will destroy the thinker.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash with thinkers on exit

Post by _mental_ »

The problem is that file indeed, at line 277

Code: Select all

override void OnDestroy()
{
	players[0].mo.A_SetInventory("SmileHard",0);
	// ...
players[0].mo is null but there is no check for this case.

At the moment I cannot say why the exception wasn't handled by the engine.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Crash with thinkers on exit

Post by Graf Zahl »

It probably was but as it happens during exiting it may just cause some problems down the line.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Crash with thinkers on exit

Post by Major Cooke »

Ah hell. Okay. Yep, just adding a check for players[0].mo fixed that.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash with thinkers on exit

Post by _mental_ »

C++ Reference about std::atexit() wrote:If a function exits via an exception, std::terminate is called.
Looks like it’s our case. But even if this works there are still a few issues with graceful shutdown when exception is thrown during exiting.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Crash with thinkers on exit

Post by _mental_ »

With the current implementation is impossible to report errors to user during shutdown.
There are two options: to ignore exception silently and to leave everything as is.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Crash with thinkers on exit

Post by Graf Zahl »

In that case I'd leave everything as it is. At least the crash provides some info that'd otherwise got lost.
Post Reply

Return to “Closed Bugs [GZDoom]”