Calling DepleteAmmo in DECORATE crashes.

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
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Calling DepleteAmmo in DECORATE crashes.

Post by Accensus »

Tested on GZDoom g4.4pre-326-g3dfb417f0 x64.

1. give CrashyPistol
2. use CrashyPistol

I assume this isn't an issue only with DepleteAmmo; it just so happened that it crashed on me with that. If I use it in an anonymous function, it errors out properly (i.e. complains about trying to call it with incompatible self-pointer, which isn't gonna happen in DECORATE).

Code: Select all

Actor CrashyPistol : Pistol
{
	States
	{
		Fire:
		    PISG A 4 DepleteAmmo(false, false, 1)
		    PISG B 6 A_FirePistol
		    PISG C 4
		    PISG B 5 A_ReFire
		    Goto Ready
	}
}
Attached CrashReport.zip.
Attachments
CrashReport.zip
(37.44 KiB) Downloaded 28 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Calling DepleteAmmo in DECORATE crashes.

Post by Graf Zahl »

DepleteAmmo cannot be used from DECORATE. The function would be called with the wrong parameters, but unfortunately the compiler cannot easily detect this. The function needs to be visible for ZScript to compile, but that means it's also visible to DECORATE. Only functions whose name starts with A_ are DECORATE safe. Adding any restriction here could block valid use cases.
User avatar
phantombeta
Posts: 2161
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Calling DepleteAmmo in DECORATE crashes.

Post by phantombeta »

Graf Zahl wrote:DepleteAmmo cannot be used from DECORATE. The function would be called with the wrong parameters, but unfortunately the compiler cannot easily detect this. The function needs to be visible for ZScript to compile, but that means it's also visible to DECORATE. Only functions whose name starts with A_ are DECORATE safe. Adding any restriction here could block valid use cases.
I told him to make this report. The point of it is not that he thinks it should work - he knows that, it's the crash that's the issue.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Calling DepleteAmmo in DECORATE crashes.

Post by Graf Zahl »

I don't know how to plug this in DECORATE.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Calling DepleteAmmo in DECORATE crashes.

Post by _mental_ »

Fixed in 0e84739.
Post Reply

Return to “Closed Bugs [GZDoom]”