1
0
Fork 0

Fix a crash from the ATC Frequency dialog at the temporary expense of a small memory leak

This commit is contained in:
daveluff 2003-10-20 21:48:57 +00:00
parent 3d6686d577
commit 2454446233

View file

@ -413,31 +413,36 @@ void FGATCDialog::DoDialog() {
// //
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
static puDialogBox* atcFreqDialog; static puDialogBox* atcFreqDialog;
static puFrame* atcFreqDialogFrame; static puFrame* atcFreqDialogFrame;
static puText* atcFreqDialogMessage; static puText* atcFreqDialogMessage;
static puInput* atcFreqDialogInput; static puInput* atcFreqDialogInput;
static puOneShot* atcFreqDialogOkButton; static puOneShot* atcFreqDialogOkButton;
static puOneShot* atcFreqDialogCancelButton; static puOneShot* atcFreqDialogCancelButton;
//static puButtonBox* atcFreqDialogCommunicationOptions;
static puText* atcFreqDisplayText[20]; static puDialogBox* atcFreqDisplay;
static puFrame* atcFreqDisplayFrame;
static puText* atcFreqDisplayMessage;
static puOneShot* atcFreqDisplayOkButton;
static puOneShot* atcFreqDisplayCancelButton;
static puText* atcFreqDisplayText[20];
static void FreqDialogCancel(puObject*) { static void FreqDialogCancel(puObject*) {
FG_POP_PUI_DIALOG(atcFreqDialog); FG_POP_PUI_DIALOG(atcFreqDialog);
delete atcFreqDialog;
} }
static void FreqDialogOK(puObject*) { static void FreqDialogOK(puObject*) {
string tmp = atcFreqDialogInput->getStringValue(); string tmp = atcFreqDialogInput->getStringValue();
FG_POP_PUI_DIALOG(atcFreqDialog); FG_POP_PUI_DIALOG(atcFreqDialog);
delete atcFreqDialog;
current_atcdialog->FreqDisplay(tmp); current_atcdialog->FreqDisplay(tmp);
} }
static void FreqDisplayOK(puObject*) { static void FreqDisplayOK(puObject*) {
FG_POP_PUI_DIALOG(atcFreqDialog); FG_POP_PUI_DIALOG(atcFreqDisplay);
delete atcFreqDialog; }
static void FreqDisplayCancel(puObject*) {
FG_POP_PUI_DIALOG(atcFreqDisplay);
} }
void FGATCDialog::FreqDialog() { void FGATCDialog::FreqDialog() {
@ -471,8 +476,6 @@ void FGATCDialog::FreqDialog() {
atcFreqDialogMessage -> setDefaultValue ("Enter airport identifier:"); atcFreqDialogMessage -> setDefaultValue ("Enter airport identifier:");
atcFreqDialogMessage -> getDefaultValue (&s); atcFreqDialogMessage -> getDefaultValue (&s);
atcFreqDialogMessage -> setLabel (s); atcFreqDialogMessage -> setLabel (s);
//atcFreqDialogMessage -> setLabelPlace (PUPLACE_TOP_CENTERED);
//atcFreqDialogMessage -> setLabelPlace (0);
atcFreqDialogInput = new puInput (50, (hsize - 75), 150, (hsize - 45)); atcFreqDialogInput = new puInput (50, (hsize - 75), 150, (hsize - 45));
atcFreqDialogInput->acceptInput(); atcFreqDialogInput->acceptInput();
@ -552,14 +555,14 @@ void FGATCDialog::FreqDisplay(string ident) {
} }
int hsize = (n < 0 ? 100 : 105 + (n * 30)); int hsize = (n < 0 ? 100 : 105 + (n * 30));
atcFreqDialog = new puDialogBox (250, 50); atcFreqDisplay = new puDialogBox (250, 50);
{ {
atcFreqDialogFrame = new puFrame (0, 0, 400, hsize); atcFreqDisplayFrame = new puFrame (0, 0, 400, hsize);
atcFreqDialogMessage = new puText (40, (hsize - 30)); atcFreqDisplayMessage = new puText (40, (hsize - 30));
atcFreqDialogMessage -> setDefaultValue (label.c_str()); atcFreqDisplayMessage -> setDefaultValue (label.c_str());
atcFreqDialogMessage -> getDefaultValue (&s); atcFreqDisplayMessage -> getDefaultValue (&s);
atcFreqDialogMessage -> setLabel (s); atcFreqDisplayMessage -> setLabel (s);
for(int i=0; i<n; ++i) { for(int i=0; i<n; ++i) {
atcFreqDisplayText[i] = new puText(40, hsize - 65 - (30 * i)); atcFreqDisplayText[i] = new puText(40, hsize - 65 - (30 * i));
@ -568,19 +571,19 @@ void FGATCDialog::FreqDisplay(string ident) {
atcFreqDisplayText[i]-> setLabel (s); atcFreqDisplayText[i]-> setLabel (s);
} }
atcFreqDialogOkButton = new puOneShot (50, 10, 110, 50); atcFreqDisplayOkButton = new puOneShot (50, 10, 110, 50);
atcFreqDialogOkButton -> setLegend (gui_msg_OK); atcFreqDisplayOkButton -> setLegend (gui_msg_OK);
atcFreqDialogOkButton -> makeReturnDefault (TRUE); atcFreqDisplayOkButton -> makeReturnDefault (TRUE);
atcFreqDialogOkButton -> setCallback (FreqDisplayOK); atcFreqDisplayOkButton -> setCallback (FreqDisplayOK);
atcFreqDialogCancelButton = new puOneShot (140, 10, 210, 50); atcFreqDisplayCancelButton = new puOneShot (140, 10, 210, 50);
atcFreqDialogCancelButton -> setLegend (gui_msg_CANCEL); atcFreqDisplayCancelButton -> setLegend (gui_msg_CANCEL);
atcFreqDialogCancelButton -> setCallback (FreqDialogCancel); atcFreqDisplayCancelButton -> setCallback (FreqDisplayCancel);
} }
FG_FINALIZE_PUI_DIALOG(atcFreqDialog); FG_FINALIZE_PUI_DIALOG(atcFreqDisplay);
FG_PUSH_PUI_DIALOG(atcFreqDialog); FG_PUSH_PUI_DIALOG(atcFreqDisplay);
} }