ccmake: Delete main form on exit after a failed configure

When Configure() or Generate() failed with -2 (e.g. no CMakeLists.txt
in the source directory) they returned while CurrentForm still pointed
at the message form.  main() then deleted that form instead of the main
form, leaking the main form together with its cmake instance.
This commit is contained in:
Christoph Grüninger committed 2026-10-28 23:37:39 +01:00
1 parent 5532f2c69d
commit 952a327c7b
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -186,8 +186,8 @@ int main(int argc, char const* const* argv)
clear();
touchwin(stdscr);
endwin();
delete cmCursesForm::CurrentForm;
cmCursesForm::CurrentForm = nullptr;
delete myform;
std::cout << std::endl << std::endl;
+2
View File
@@ -537,6 +537,7 @@ int cmCursesMainForm::Configure(int noconfigure)
// If they typed the wrong source directory, we report
// an error and exit
if (retVal == -2) {
CurrentForm = this;
return retVal;
}
}
@@ -590,6 +591,7 @@ int cmCursesMainForm::Generate()
// If they typed the wrong source directory, we report
// an error and exit
if (retVal == -2) {
CurrentForm = this;
return retVal;
}
}