A_RemoveLight causes crash

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.
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

A_RemoveLight causes crash

Post by Rip and Tear »

Calling A_RemoveLight can cause the game to crash completely (not a VM abort). GZDoom 4.2.0 / macOS 10.14.6

I attached a WAD file to use for testing the bug.

1. Start the game
2. Type `netevent attachlight` in the console
3. Type `netevent removelight` in the console
(close the console between each of these so the game can unpause)

Repeat until the game crashes (usually takes me 2-5 tries). Moving around seems to help, also.

There are also weird rendering artifacts that appear, but I wasn't able to get a screenshot because they only show up for a few frames.
Attachments
AttachLightTest.wad
(483 Bytes) Downloaded 59 times
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: A_RemoveLight causes crash

Post by _mental_ »

There are two related problems here.

The main issue is RemoveLight() function. It deletes an entry from AActor::UserLights while AActor::AttachedLights still contains dynamic light created from that removed entry.
The minor issue is the light attachment happens on state change. If this is not the case (e.g. stand still player in this sample), a light won't appear until player moves/shoots/whatever.
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: A_RemoveLight causes crash

Post by Graf Zahl »

I think the SetDynamicLights call needs to be moved to a place after Tick has run - with each place where lights change only flagging the needed change - to avoid redoing this more often than necessary.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: A_RemoveLight causes crash

Post by _mental_ »

This is fine, although I would like to fix the main issue first. I don't really get where lights should be removed from AttachedLights. At the moment, they seem to be removed during actors destruction only.
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: A_RemoveLight causes crash

Post by Graf Zahl »

AttachedLights will be taken care of when the current list of active lights gets created in SetDynamicLights. Since that isn't called when no state change takes place between setting/removing the light, the list of attached lights will be stale in that case and contain incorrect data.

This actually is a bit more tricky. Since the AttachLight function family can be called from outside the actor, the only fix is to only set a flag, and once the game ticker has completed running, process all actors that got flagged for a light change.
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: A_RemoveLight causes crash

Post by Graf Zahl »

Fixed.
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

Re: A_RemoveLight causes crash

Post by Rip and Tear »

I am still experiencing this issue as of GZDoom 4.2.1.
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: A_RemoveLight causes crash

Post by Graf Zahl »

Same demo mod? When I last tried it it worked.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: A_RemoveLight causes crash

Post by drfrag »

For me it doesn't crash in the latest master.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: A_RemoveLight causes crash

Post by Rachael »

Sounds like you have something else loaded that is causing issues, and probably should be reported as a new bug so that it can also get fixed, too.
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

Re: A_RemoveLight causes crash

Post by Rip and Tear »

Yes, I tested it with the same demo wad and the -noautoload command line parameter.

It may be a macOS specific issue.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: A_RemoveLight causes crash

Post by _mental_ »

What was the exact build version?
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

Re: A_RemoveLight causes crash

Post by Rip and Tear »

_mental_ wrote:What was the exact build version?
Just the release version of 4.2.1. Not sure how to get any more specific than that.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: A_RemoveLight causes crash

Post by _mental_ »

It was fixed after 4.2.1 was released.
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

Re: A_RemoveLight causes crash

Post by Rip and Tear »

_mental_ wrote:It was fixed after 4.2.1 was released.
I must be missing something here, since this bug report was closed on August 18th and GZDoom 4.2.1 was released September 10th.
Post Reply

Return to “Closed Bugs [GZDoom]”