r1069 Crash with QNA (sound?)

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
Enjay
 
 
Posts: 26987
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

r1069 Crash with QNA (sound?)

Post by Enjay »

With the "Quake: Nexus Aftermath" demo from this thread,
http://forum.zdoom.org/viewtopic.php?f= ... a&start=15

Zdoom r1069 and GZdoom r131 crash shortly after starting a game for me. I load up Zdoom with the file loaded, pick a player class then start a game and shortly afterwards, Zdoom crashes.

I made a debug build and here's what I got. It seems to be pointing at something in the sound code?
Spoiler:
s_sound.cpp was loaded by the debugger and the little yellow arrow was beside this bit:

Code: Select all

//==========================================================================
//
// S_Sound - An actor is source
//
//==========================================================================

void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation)
{
	if (ent->Sector->Flags & SECF_SILENT)
		return;
	S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
}
Specifically

Code: Select all

if (ent->Sector->Flags & SECF_SILENT)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r1069 Crash with QNA (sound?)

Post by Graf Zahl »

From a quick look my guess would be an ACS ActivatorSound with a NULL activator. I have no time to investigate it right now though.
User avatar
Enjay
 
 
Posts: 26987
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: r1069 Crash with QNA (sound?)

Post by Enjay »

I think this is it. Script 310 is run by script 23, an open script. Script 310 has the line "ActivatorSound("NewObjective", 127);" and if I comment it out, the crash no longer happens. Presumably the "activator" for the "ActivatorSound" cannot be the world, which, again presumably, it is in this case because of the open script calling script 310.

Code: Select all

//Objective script
script 310 (void) Net
{   
	If ( GameType() == Game_Net_DeathMatch )
		{
		}
	Else
		{
		ActivatorSound("NewObjective", 127);
		SetFont("MAP1GOAL");
		SetHudSize(1024, 768, 0);
		HudMessage(s:"A"; HUDMSG_FADEOUT, 0, 0, 865.0, 160.0, 3.5, 0.5);
		}
}

//Exit Perimeter Defense Station and proceed to Strogg Medical Facility, eliminate all resistance

Script 23 OPEN
{
	ACS_Execute (310, 0, 0, 0, 0);
}
Gez
 
 
Posts: 17942
Joined: Fri Jul 06, 2007 3:22 pm

Re: r1069 Crash with QNA (sound?)

Post by Gez »

Yeah, but the real bug isn't in the script. Pointers should always be checked for NULLdom.

Code: Select all

//==========================================================================
//
// S_Sound - An actor is source
//
//==========================================================================

void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation)
{
   if (!ent || (ent->Sector->Flags & SECF_SILENT))
      return;
   S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
}
With such a change, the function does nothing if ent equals NULL or if ent points to an existing actor which is in a silent sector. Otherwise (ent is not null but points to a n actor in a sector which isn't silent), it calls S_StartSound.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r1069 Crash with QNA (sound?)

Post by Graf Zahl »

Nope. With a NULL activator the sound must be made global.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: r1069 Crash with QNA (sound?)

Post by Ghastly »

Would a fix for this work with the other activator-based sounds? I was going to change ActivatorSound to LocalAmbientSound (Other players shouldn't be able to hear it, since players could use it to spam sounds).
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: r1069 Crash with QNA (sound?)

Post by randi »

I don't consider passing a NULL actor a valid way to produce a global sound anymore, since there is an emitter-less version of the function for just that purpose. Assuming the instances where S_Sound is passed a user-specified actor are limited, I think it would be better to add NULL checks to those spots and keep S_Sound silent when passed a NULL actor, for the sake of having a less redundant interface to the sound system.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r1069 Crash with QNA (sound?)

Post by Graf Zahl »

But then the ACS function needs to be changed - because there's inevitably some WADs that expect this behavior to remain.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: r1069 Crash with QNA (sound?)

Post by randi »

Hence the reason I wrote:
randy wrote:Assuming the instances where S_Sound is passed a user-specified actor are limited, I think it would be better to add NULL checks to those spots
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r1069 Crash with QNA (sound?)

Post by Graf Zahl »

Fixed
Post Reply

Return to “Closed Bugs [GZDoom]”