mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
ccmake: Do not leak long message forms
The forms showing configure/generate output, help, and the log were allocated with new and never deleted. Make them local objects, and point CurrentForm back to the main form as soon as they are closed so the resize handler never sees a destroyed form.
This commit is contained in:
1 parent
952a327c7b
commit
e67a011e90
1 file changed
+18
-18
@@ -526,18 +526,18 @@ int cmCursesMainForm::Configure(int noconfigure)
|
||||
if (cmSystemTools::GetErrorOccurredFlag()) {
|
||||
title = "Configure failed with the following output";
|
||||
}
|
||||
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
|
||||
cmCursesLongMessageForm msgs(
|
||||
this->Outputs, title,
|
||||
cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
|
||||
// reset error condition
|
||||
cmSystemTools::ResetErrorOccurredFlag();
|
||||
CurrentForm = msgs;
|
||||
msgs->Render(1, 1, xx, yy);
|
||||
msgs->HandleInput();
|
||||
CurrentForm = &msgs;
|
||||
msgs.Render(1, 1, xx, yy);
|
||||
msgs.HandleInput();
|
||||
CurrentForm = this;
|
||||
// If they typed the wrong source directory, we report
|
||||
// an error and exit
|
||||
if (retVal == -2) {
|
||||
CurrentForm = this;
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -582,16 +582,16 @@ int cmCursesMainForm::Generate()
|
||||
if (cmSystemTools::GetErrorOccurredFlag()) {
|
||||
title = "Generate failed with the following output";
|
||||
}
|
||||
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
|
||||
cmCursesLongMessageForm msgs(
|
||||
this->Outputs, title,
|
||||
cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
|
||||
CurrentForm = msgs;
|
||||
msgs->Render(1, 1, xx, yy);
|
||||
msgs->HandleInput();
|
||||
CurrentForm = &msgs;
|
||||
msgs.Render(1, 1, xx, yy);
|
||||
msgs.HandleInput();
|
||||
CurrentForm = this;
|
||||
// If they typed the wrong source directory, we report
|
||||
// an error and exit
|
||||
if (retVal == -2) {
|
||||
CurrentForm = this;
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -876,12 +876,12 @@ void cmCursesMainForm::HandleInput()
|
||||
this->HelpMessage[1] = "";
|
||||
}
|
||||
|
||||
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
|
||||
cmCursesLongMessageForm msgs(
|
||||
this->HelpMessage, "Help",
|
||||
cmCursesLongMessageForm::ScrollBehavior::NoScroll);
|
||||
CurrentForm = msgs;
|
||||
msgs->Render(1, 1, x, y);
|
||||
msgs->HandleInput();
|
||||
CurrentForm = &msgs;
|
||||
msgs.Render(1, 1, x, y);
|
||||
msgs.HandleInput();
|
||||
CurrentForm = this;
|
||||
this->Render(1, 1, x, y);
|
||||
set_current_field(this->Form, cur);
|
||||
@@ -889,12 +889,12 @@ void cmCursesMainForm::HandleInput()
|
||||
// display last errors
|
||||
else if (key == 'l') {
|
||||
getmaxyx(stdscr, y, x);
|
||||
cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
|
||||
cmCursesLongMessageForm msgs(
|
||||
this->Outputs, "CMake produced the following output",
|
||||
cmCursesLongMessageForm::ScrollBehavior::NoScroll);
|
||||
CurrentForm = msgs;
|
||||
msgs->Render(1, 1, x, y);
|
||||
msgs->HandleInput();
|
||||
CurrentForm = &msgs;
|
||||
msgs.Render(1, 1, x, y);
|
||||
msgs.HandleInput();
|
||||
CurrentForm = this;
|
||||
this->Render(1, 1, x, y);
|
||||
} else if (key == '/') {
|
||||
|
||||
Reference in new issue
Block a user