A_RemoveLight causes crash
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.
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.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
A_RemoveLight causes crash
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.
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
Re: A_RemoveLight causes crash
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_RemoveLight causes crash
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.
Re: A_RemoveLight causes crash
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_RemoveLight causes crash
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.
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.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: A_RemoveLight causes crash
I am still experiencing this issue as of GZDoom 4.2.1.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_RemoveLight causes crash
Same demo mod? When I last tried it it worked.
- drfrag
- Vintage GZDoom Developer
- Posts: 3141
- Joined: Fri Apr 23, 2004 3:51 am
- Location: Spain
- Contact:
Re: A_RemoveLight causes crash
For me it doesn't crash in the latest master.
Re: A_RemoveLight causes crash
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.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: A_RemoveLight causes crash
Yes, I tested it with the same demo wad and the -noautoload command line parameter.
It may be a macOS specific issue.
It may be a macOS specific issue.
Re: A_RemoveLight causes crash
What was the exact build version?
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: A_RemoveLight causes crash
Just the release version of 4.2.1. Not sure how to get any more specific than that._mental_ wrote:What was the exact build version?
Re: A_RemoveLight causes crash
It was fixed after 4.2.1 was released.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: A_RemoveLight causes crash
I must be missing something here, since this bug report was closed on August 18th and GZDoom 4.2.1 was released September 10th._mental_ wrote:It was fixed after 4.2.1 was released.