Using local uninitialized (?) class arrays causes crash

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

Using local uninitialized (?) class arrays causes crash

Post 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.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

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

Post by _mental_ »

Fixed in 11ba0be.
Post Reply

Return to “Closed Bugs [GZDoom]”