Page 1 of 1

Using local uninitialized (?) class arrays causes crash

Posted: Thu Jun 04, 2020 8:34 am
by Accensus
Tested with both with 4.3.3 and GZDoom g4.4pre-326-g3dfb417f0. Happens on both.

Here's the following code:

Code: Select all

class TreasureImp : DoomImp
{
	override void Die(Actor source, Actor inflictor, int dmgflags)
	{
		class<Ammo> AmmoTypes[3];
		
		// for (int i = 0; i < AmmoTypes.Size(); ++i)
		// {
		// 	AmmoTypes[i] = null;
		// }

		A_DropItem(AmmoTypes[random(0, AmmoTypes.Size() - 1)]);

		Super.Die(source, inflictor, dmgflags);
	}
}
Spawn two TreasureImp actors on top of each other and do mdk. It will crash to desktop. The interesting thing is that it won't happen if you uncomment the for loop that will initialize the array. It will also not happen if you use a string array instead of class<Ammo>. No crash if you only spawn one imp either.

Re: Using local uninitialized (?) class arrays causes crash

Posted: Sun Jun 07, 2020 2:36 am
by _mental_
Fixed in 11ba0be.