[Fix inside]Camera + Morph = 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.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
[Fix inside]Camera + Morph = Crash
- Attachments
-
- playermorphcrash.zip
- Give SMM in console.
- (6.45 KiB) Downloaded 77 times
Last edited by Major Cooke on Thu Sep 01, 2016 1:08 pm, edited 8 times in total.
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Odd unmorph crashing bug
it would be interesting to know what are the values of 'type' and, if it's not null, 'i' and 'type->Slot'..
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
I have managed to reproduce it on a much simpler scale. Attached in the first post is a test example.
"Give SMM" in console. Don't mind the fact that you cannot move.
A couple seconds later, the game crashes from the morph expiring.
"Give SMM" in console. Don't mind the fact that you cannot move.
A couple seconds later, the game crashes from the morph expiring.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Camera + Morph = Crash
Still very much 'ugh'.
For some reason it encounters a player class object that isn't fully initialized and crashes on the garbage data.
The big problem is, that cause and effect are in completely separate parts of the code.
For some reason it encounters a player class object that isn't fully initialized and crashes on the garbage data.
The big problem is, that cause and effect are in completely separate parts of the code.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
Youch. Yeah, it is weird when it happens especially because the player's view is just outside of the actor. Hmmm...
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Camera + Morph = Crash
Regarding the original problem, I got this asan error with the wad:
I wonder what's going on...
Spoiler:and this is gdb backtrace:
Spoiler:Incidentally, I got another asan error when I just got the morphing item and then directly removed the powerup (no camera switch):
Spoiler:and this is the backtrace from gdb:
Spoiler:with these messages from the log before the crash:
Code: Select all
user_lastHP is not a user variable in class DoomPlayer
user_camang is not a user variable in class DoomPlayer
user_dirget is not a user variable in class DoomPlayer
user_dirforward is not a user variable in class DoomPlayer
user_dirside is not a user variable in class DoomPlayer
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
Try the new test.pk3.
Now, if you're wondering, overlays are not cleared when unmorphing. Something I told Leonard about but he said they'll be fixed when Actor Overlays are implemented, he said. But as you can see from the new test.pk3, there's no overlays at all.
Now, if you're wondering, overlays are not cleared when unmorphing. Something I told Leonard about but he said they'll be fixed when Actor Overlays are implemented, he said. But as you can see from the new test.pk3, there's no overlays at all.
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Camera + Morph = Crash
urgh please use a different name to the wad instead of the repetitive 'test'. Anyways, I see no change either in gdb and asan output.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
Meh.
Anyway, anything else I can try to do for this? Or is this something randi has to look into?
Anyway, anything else I can try to do for this? Or is this something randi has to look into?
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Camera + Morph = Crash
Can you add a test wad which does just morph and unmorph? In a post above, I mentioned a problem with those steps and would like to check it again.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
Okay, first post updated. User variables removed.
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Camera + Morph = Crash
It seems that this line in decorate.txt:
makes sure that the morphed actor's tracer, which points to the actor before morphing, is overridden with the camera:
from InitSpawnedItem, called by A_SpawnItemEx.
The old actor's information is lost, making the program crash when attempting to unmorph, because it's trying to get the player's info from invalid actor.
In order to fix this, I suspect the old actor pointer should be stored in a different place than the 'tracer'. Graf?
Code: Select all
A_SpawnItemEx("ChaseCam",-10,0,32,0,0,0,0,SXF_NOCHECKPOSITION|SXF_SETMASTER|SXF_ISTRACER,0,32700);
Code: Select all
if (flags & SIXF_ISTRACER)
{
self->tracer = mo;
}
The old actor's information is lost, making the program crash when attempting to unmorph, because it's trying to get the player's info from invalid actor.
In order to fix this, I suspect the old actor pointer should be stored in a different place than the 'tracer'. Graf?
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Camera + Morph = Crash
I tested it again just to make sure:
This doesn't crash, backing up Edward's words possibly.
Code: Select all
Spawn:
PLAY A 95 NoDelay
{
SetPlayerProperty(0,1,PROP_TOTALLYFROZEN);
A_PrintBold("Camera On");
A_SpawnItemEx("ChaseCam",-10,0,32,0,0,0,0,SXF_NOCHECKPOSITION|SXF_SETMASTER|SXF_ISTRACER,0,32700);
ChangeCamera(32700,0,0);
}
PLAY A 0
{
A_RemoveChildren(true,RMVF_EVERYTHING,"ChaseCam");
}
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Camera + Morph = Crash
Correct. Since it's no longer safe to use tracer for this, a different variable is needed.Edward-san wrote: In order to fix this, I suspect the old actor pointer should be stored in a different place than the 'tracer'. Graf?
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Camera + Morph = Crash
I hope there's nothing which (ab)used the morphed tracer data...