mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
ccmake: Free main form before destroying cache entry fields
InitializeUI() replaced the cache entry widgets and the "EMPTY CACHE" placeholder, and RemoveEntry() erased an entry, while the form still referenced their fields. free_field() fails on connected fields, so every reconfigure and every deleted entry leaked fields. Free the form first; RePost() and Render() create a new one afterwards.
This commit is contained in:
1 parent
1835cffe66
commit
5532f2c69d
1 file changed
+13
@@ -74,6 +74,13 @@ void cmCursesMainForm::InitializeUI()
|
||||
// Hide the cursor by default
|
||||
curs_set(0);
|
||||
|
||||
// Free the form before destroying the fields it references
|
||||
if (this->Form) {
|
||||
unpost_form(this->Form);
|
||||
free_form(this->Form);
|
||||
this->Form = nullptr;
|
||||
}
|
||||
|
||||
// Create a vector of cmCursesCacheEntryComposite's
|
||||
// which contain labels, entries and new entry markers
|
||||
std::vector<cmCursesCacheEntryComposite> newEntries;
|
||||
@@ -620,6 +627,12 @@ void cmCursesMainForm::RemoveEntry(char const* value)
|
||||
|
||||
if (removeIt != this->Entries.end()) {
|
||||
this->CMakeInstance->UnwatchUnusedCli(value);
|
||||
// Free the form before destroying the fields it references
|
||||
if (this->Form) {
|
||||
unpost_form(this->Form);
|
||||
free_form(this->Form);
|
||||
this->Form = nullptr;
|
||||
}
|
||||
this->Entries.erase(removeIt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user