mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
Merge topic 'ccmake-delete-cache'
2defe9ff95ccmake: Fix crash when deleting all cache entriese1c85e29f4ccmake: Move Initialization of Fields Inline Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7257
This commit is contained in:
@@ -35,11 +35,6 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> args,
|
|||||||
: Args(std::move(args))
|
: Args(std::move(args))
|
||||||
, InitialWidth(initWidth)
|
, InitialWidth(initWidth)
|
||||||
{
|
{
|
||||||
this->HasNonStatusOutputs = false;
|
|
||||||
this->NumberOfPages = 0;
|
|
||||||
this->AdvancedMode = false;
|
|
||||||
this->NumberOfVisibleEntries = 0;
|
|
||||||
this->OkToGenerate = false;
|
|
||||||
this->HelpMessage.emplace_back(
|
this->HelpMessage.emplace_back(
|
||||||
"Welcome to ccmake, curses based user interface for CMake.");
|
"Welcome to ccmake, curses based user interface for CMake.");
|
||||||
this->HelpMessage.emplace_back();
|
this->HelpMessage.emplace_back();
|
||||||
@@ -54,7 +49,6 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> args,
|
|||||||
cmStrCat(cmSystemTools::GetProgramPath(this->Args[0]), "/cmake");
|
cmStrCat(cmSystemTools::GetProgramPath(this->Args[0]), "/cmake");
|
||||||
this->Args[0] = whereCMake;
|
this->Args[0] = whereCMake;
|
||||||
this->CMakeInstance->SetArgs(this->Args);
|
this->CMakeInstance->SetArgs(this->Args);
|
||||||
this->SearchMode = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCursesMainForm::~cmCursesMainForm()
|
cmCursesMainForm::~cmCursesMainForm()
|
||||||
@@ -99,13 +93,13 @@ void cmCursesMainForm::InitializeUI()
|
|||||||
|
|
||||||
int entrywidth = this->InitialWidth - 35;
|
int entrywidth = this->InitialWidth - 35;
|
||||||
|
|
||||||
if (count == 0) {
|
// Add a label to display when cache is empty
|
||||||
// If cache is empty, display a label saying so and a
|
// dummy entry widget (does not respond to input)
|
||||||
// dummy entry widget (does not respond to input)
|
cmCursesCacheEntryComposite comp("EMPTY CACHE", 30, 30);
|
||||||
cmCursesCacheEntryComposite comp("EMPTY CACHE", 30, 30);
|
comp.Entry = cm::make_unique<cmCursesDummyWidget>(1, 1, 1, 1);
|
||||||
comp.Entry = cm::make_unique<cmCursesDummyWidget>(1, 1, 1, 1);
|
newEntries.emplace_back(std::move(comp));
|
||||||
newEntries.emplace_back(std::move(comp));
|
|
||||||
} else {
|
if (count > 0) {
|
||||||
// Create the composites.
|
// Create the composites.
|
||||||
|
|
||||||
// First add entries which are new
|
// First add entries which are new
|
||||||
@@ -196,7 +190,8 @@ void cmCursesMainForm::RePost()
|
|||||||
this->Fields.push_back(entry.Entry->Field);
|
this->Fields.push_back(entry.Entry->Field);
|
||||||
}
|
}
|
||||||
// if no cache entries there should still be one dummy field
|
// if no cache entries there should still be one dummy field
|
||||||
if (this->Fields.empty()) {
|
this->IsEmpty = this->Fields.empty();
|
||||||
|
if (this->IsEmpty) {
|
||||||
const auto& front = this->Entries.front();
|
const auto& front = this->Entries.front();
|
||||||
this->Fields.push_back(front.Label->Field);
|
this->Fields.push_back(front.Label->Field);
|
||||||
this->Fields.push_back(front.IsNewLabel->Field);
|
this->Fields.push_back(front.IsNewLabel->Field);
|
||||||
@@ -875,7 +870,7 @@ void cmCursesMainForm::HandleInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete cache entry
|
// delete cache entry
|
||||||
else if (key == 'd' && this->NumberOfVisibleEntries) {
|
else if (key == 'd' && this->NumberOfVisibleEntries && !this->IsEmpty) {
|
||||||
this->OkToGenerate = false;
|
this->OkToGenerate = false;
|
||||||
FIELD* cur = current_field(this->Form);
|
FIELD* cur = current_field(this->Form);
|
||||||
size_t findex = field_index(cur);
|
size_t findex = field_index(cur);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ protected:
|
|||||||
// Output produced by the last pass
|
// Output produced by the last pass
|
||||||
std::vector<std::string> Outputs;
|
std::vector<std::string> Outputs;
|
||||||
// Did the last pass produced outputs of interest (errors, warnings, ...)
|
// Did the last pass produced outputs of interest (errors, warnings, ...)
|
||||||
bool HasNonStatusOutputs;
|
bool HasNonStatusOutputs = false;
|
||||||
// Last progress bar
|
// Last progress bar
|
||||||
std::string LastProgress;
|
std::string LastProgress;
|
||||||
|
|
||||||
@@ -155,17 +155,18 @@ protected:
|
|||||||
// Fields displayed. Includes labels, new entry markers, entries
|
// Fields displayed. Includes labels, new entry markers, entries
|
||||||
std::vector<FIELD*> Fields;
|
std::vector<FIELD*> Fields;
|
||||||
// Number of entries shown (depends on mode -normal or advanced-)
|
// Number of entries shown (depends on mode -normal or advanced-)
|
||||||
size_t NumberOfVisibleEntries;
|
size_t NumberOfVisibleEntries = 0;
|
||||||
bool AdvancedMode;
|
bool AdvancedMode = false;
|
||||||
// Did the iteration converge (no new entries) ?
|
// Did the iteration converge (no new entries) ?
|
||||||
bool OkToGenerate;
|
bool OkToGenerate = false;
|
||||||
// Number of pages displayed
|
// Number of pages displayed
|
||||||
int NumberOfPages;
|
int NumberOfPages = 0;
|
||||||
|
bool IsEmpty = false;
|
||||||
|
|
||||||
int InitialWidth;
|
int InitialWidth;
|
||||||
std::unique_ptr<cmake> CMakeInstance;
|
std::unique_ptr<cmake> CMakeInstance;
|
||||||
|
|
||||||
std::string SearchString;
|
std::string SearchString;
|
||||||
std::string OldSearchString;
|
std::string OldSearchString;
|
||||||
bool SearchMode;
|
bool SearchMode = false;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user