[Fixed] [Fix inside]Camera + Morph = Crash

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[Fix inside]Camera + Morph = Crash

Postby Major Cooke » Sat Aug 13, 2016 5:23 pm

EDIT: Bugfix PR.

Download the test.pk3 attached. Give SMM in console. A few seconds later, crash.
Attachments
playermorphcrash.zip
Give SMM in console.
(6.45 KiB) Downloaded 29 times
Last edited by Major Cooke on Thu Sep 01, 2016 2:08 pm, edited 8 times in total.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Odd unmorph crashing bug

Postby Edward-san » Sat Aug 13, 2016 5:37 pm

it would be interesting to know what are the values of 'type' and, if it's not null, 'i' and 'type->Slot[i]'..
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Camera + Morph = Crash

Postby Major Cooke » Mon Aug 15, 2016 9:41 am

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.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Graf Zahl » Mon Aug 15, 2016 10:02 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Camera + Morph = Crash

Postby Major Cooke » Mon Aug 15, 2016 1:31 pm

Youch. Yeah, it is weird when it happens especially because the player's view is just outside of the actor. Hmmm...
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Edward-san » Mon Aug 15, 2016 4:30 pm

Regarding the original problem, I got this asan error with the wad:

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 allExpand view
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


I wonder what's going on...
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Camera + Morph = Crash

Postby Major Cooke » Mon Aug 15, 2016 4:35 pm

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.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Edward-san » Mon Aug 15, 2016 5:00 pm

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.
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Camera + Morph = Crash

Postby Major Cooke » Sun Aug 21, 2016 8:21 am

Meh.

Anyway, anything else I can try to do for this? Or is this something randi has to look into?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Edward-san » Sun Aug 21, 2016 2:28 pm

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.
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Camera + Morph = Crash

Postby Major Cooke » Thu Aug 25, 2016 1:34 pm

Okay, first post updated. User variables removed.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Edward-san » Wed Aug 31, 2016 3:35 pm

It seems that this line in decorate.txt:

Code: Select allExpand view
         A_SpawnItemEx("ChaseCam",-10,0,32,0,0,0,0,SXF_NOCHECKPOSITION|SXF_SETMASTER|SXF_ISTRACER,0,32700);


makes sure that the morphed actor's tracer, which points to the actor before morphing, is overridden with the camera:

Code: Select allExpand view
   if (flags & SIXF_ISTRACER)
   {
      self->tracer = mo;
   }

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?
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Camera + Morph = Crash

Postby Major Cooke » Wed Aug 31, 2016 3:44 pm

I tested it again just to make sure:

Code: Select allExpand view
   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");
      }


This doesn't crash, backing up Edward's words possibly.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Camera + Morph = Crash

Postby Graf Zahl » Wed Aug 31, 2016 3:49 pm

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?


Correct. Since it's no longer safe to use tracer for this, a different variable is needed.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Camera + Morph = Crash

Postby Edward-san » Wed Aug 31, 2016 3:53 pm

I hope there's nothing which (ab)used the morphed tracer data...
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Next

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests