mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 12:11:04 -06:00
ccmake: Fix infinite loop during invalid search
Fix issue introduced in commit 2defe9ff95 (ccmake: Fix crash when
deleting all cache entries, 2022-05-12).
Leaving the Empty Cache widget always on the Entry list had unforeseen
consequences, including that it caused an infinite loop when searching
for a string that did not match any variables.
This commit is contained in:
@@ -95,9 +95,10 @@ void cmCursesMainForm::InitializeUI()
|
|||||||
|
|
||||||
// Add a label to display when cache is empty
|
// Add a label to display when cache is empty
|
||||||
// dummy entry widget (does not respond to input)
|
// dummy entry widget (does not respond to input)
|
||||||
cmCursesCacheEntryComposite comp("EMPTY CACHE", 30, 30);
|
this->EmptyCacheEntry =
|
||||||
comp.Entry = cm::make_unique<cmCursesDummyWidget>(1, 1, 1, 1);
|
cm::make_unique<cmCursesCacheEntryComposite>("EMPTY CACHE", 30, 30);
|
||||||
newEntries.emplace_back(std::move(comp));
|
this->EmptyCacheEntry->Entry =
|
||||||
|
cm::make_unique<cmCursesDummyWidget>(1, 1, 1, 1);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
// Create the composites.
|
// Create the composites.
|
||||||
@@ -192,10 +193,9 @@ void cmCursesMainForm::RePost()
|
|||||||
// if no cache entries there should still be one dummy field
|
// if no cache entries there should still be one dummy field
|
||||||
this->IsEmpty = this->Fields.empty();
|
this->IsEmpty = this->Fields.empty();
|
||||||
if (this->IsEmpty) {
|
if (this->IsEmpty) {
|
||||||
const auto& front = this->Entries.front();
|
this->Fields.push_back(this->EmptyCacheEntry->Label->Field);
|
||||||
this->Fields.push_back(front.Label->Field);
|
this->Fields.push_back(this->EmptyCacheEntry->IsNewLabel->Field);
|
||||||
this->Fields.push_back(front.IsNewLabel->Field);
|
this->Fields.push_back(this->EmptyCacheEntry->Entry->Field);
|
||||||
this->Fields.push_back(front.Entry->Field);
|
|
||||||
this->NumberOfVisibleEntries = 1;
|
this->NumberOfVisibleEntries = 1;
|
||||||
}
|
}
|
||||||
// Has to be null terminated.
|
// Has to be null terminated.
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ protected:
|
|||||||
// Number of pages displayed
|
// Number of pages displayed
|
||||||
int NumberOfPages = 0;
|
int NumberOfPages = 0;
|
||||||
bool IsEmpty = false;
|
bool IsEmpty = false;
|
||||||
|
std::unique_ptr<cmCursesCacheEntryComposite> EmptyCacheEntry;
|
||||||
|
|
||||||
int InitialWidth;
|
int InitialWidth;
|
||||||
std::unique_ptr<cmake> CMakeInstance;
|
std::unique_ptr<cmake> CMakeInstance;
|
||||||
|
|||||||
Reference in New Issue
Block a user