Sound on a Button with certain settings will cause a Crash
by John "Mythic" Henry · in Torque Game Engine · 10/14/2006 (2:27 am) · 3 replies
Okay, with some modifications I ran into a Crash on Exit Bug!
This is when you have sounds active on a Button.
This will ONLY occur if you have that button call [ quit(); ] directly.
Heres an example:
In a GUI you have it set to profile with a sound.
That button calls [ quit(); ] as it's command. This causes an UnLink Object failure
as Sounds are Creating and Destroying themselves while quit() is trying destroy everything.
Setup to Create the Bug:
a Profile for a Button:
The Gui Button that will cause the Crash problem...
Hit that Button and it will have an invalid Object that points to nothing but falls through and
causes the crash. The invalid object is an AudioBuffer.
Simply change the [ Command = "quit();"; ] to [ Command = "schedule( 500, 0, "quit" );"; ]
and it exits nicely.
Theres alot more testing I could do, but I was able to narrow down the primary cause to calling
the [ quit(); ] function immediately. The sounds are created and destroyed as soon as they are
access, and it appears thta quit(); is stopping the sound functions from finishing it's work and thus
getting and Invalid pointer when it trys to clean up all objects..
I thought at first it was involved with the Font, but it doesn't matter if it is using the default font
or a different one. It all came down to the call for [ quit(); ].
Mythic
This is when you have sounds active on a Button.
This will ONLY occur if you have that button call [ quit(); ] directly.
Heres an example:
In a GUI you have it set to profile with a sound.
That button calls [ quit(); ] as it's command. This causes an UnLink Object failure
as Sounds are Creating and Destroying themselves while quit() is trying destroy everything.
Setup to Create the Bug:
a Profile for a Button:
if(!isObject(GuiBitmapButtonProfile)) new GuiControlProfile ("GuiBitmapButtonProfile")
{
opaque = false;
border = false;
mouseOverSelected = true;
fontType = "Book Antiqua";
fontSize = 24;
fontCharset = CHINESEBIG5;
fontColor = "0 0 0";
fontColorHL = "255 255 0";
fontColorNA = "0 0 0";
fontColorSEL= "200 200 200";
modal = true;
justify = "center";
autoSizeWidth = false;
autoSizeHeight = false;
returnTab = false;
numbersOnly = false;
cursorColor = "0 0 0 255";
// sounds
soundButtonOver = "AudioButtonOver";
soundButtonDown = "AudioButtonDown";
};The Gui Button that will cause the Crash problem...
new GuiBitmapButtonCtrl() {
Profile = "guiRPGMenuButtonTextProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "24 324";
Extent = "170 70";
MinExtent = "8 2";
Visible = "1";
Command = "quit();";
tooltipprofile = "GuiToolTipProfile";
tooltip = "Oops, get me outta here!";
text = "Exit";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "data/ui/skins/MMOKITbutton";
};Hit that Button and it will have an invalid Object that points to nothing but falls through and
causes the crash. The invalid object is an AudioBuffer.
Simply change the [ Command = "quit();"; ] to [ Command = "schedule( 500, 0, "quit" );"; ]
and it exits nicely.
Theres alot more testing I could do, but I was able to narrow down the primary cause to calling
the [ quit(); ] function immediately. The sounds are created and destroyed as soon as they are
access, and it appears thta quit(); is stopping the sound functions from finishing it's work and thus
getting and Invalid pointer when it trys to clean up all objects..
I thought at first it was involved with the Font, but it doesn't matter if it is using the default font
or a different one. It all came down to the call for [ quit(); ].
Mythic
About the author
Recent Threads
#2
Just wanted to clear out the annoying bug first... :)
10/14/2006 (4:54 pm)
Probably, I hadn't gotten around to trying different delays yet.Just wanted to clear out the annoying bug first... :)
#3
The lowest I was able to go with my system (With loads of apps running and in release mode),
was (135, 0, ..).
I suspect this will vary with different systems and what else may be running as well.
Probably safer to use (200, 0, "quit") and give it sufficient time to clear out.
10/15/2006 (1:58 am)
Okay, got around to testing this further and schedule( 0, 0, "quit" ); is too quick still.The lowest I was able to go with my system (With loads of apps running and in release mode),
was (135, 0, ..).
I suspect this will vary with different systems and what else may be running as well.
Probably safer to use (200, 0, "quit") and give it sufficient time to clear out.
Torque 3D Owner Stephen Zepp