src: fixed crash when indexing in headless mode
This commit is contained in:
@@ -403,7 +403,7 @@ void Application::refreshProject(RefreshMode refreshMode)
|
||||
{
|
||||
if (m_project && checkSharedMemory())
|
||||
{
|
||||
m_project->refresh(refreshMode, getDialogView(DialogView::UseCase::INDEXING).get());
|
||||
m_project->refresh(refreshMode, getDialogView(DialogView::UseCase::INDEXING));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ void DialogView::hideProgressDialog()
|
||||
}
|
||||
|
||||
void DialogView::startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info)
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef DIALOG_VIEW_H
|
||||
#define DIALOG_VIEW_H
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -45,7 +46,8 @@ public:
|
||||
virtual void hideProgressDialog();
|
||||
|
||||
virtual void startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info);
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing);
|
||||
virtual void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
|
||||
virtual DatabasePolicy finishedIndexingDialog(
|
||||
|
||||
@@ -225,7 +225,7 @@ void Project::load()
|
||||
}
|
||||
}
|
||||
|
||||
void Project::refresh(RefreshMode refreshMode, DialogView* dialogView)
|
||||
void Project::refresh(RefreshMode refreshMode, std::shared_ptr<DialogView> dialogView)
|
||||
{
|
||||
if (m_isIndexing)
|
||||
{
|
||||
@@ -345,7 +345,7 @@ void Project::refresh(RefreshMode refreshMode, DialogView* dialogView)
|
||||
enabledModes.insert(enabledModes.end(), { REFRESH_UPDATED_FILES, REFRESH_UPDATED_AND_INCOMPLETE_FILES });
|
||||
}
|
||||
|
||||
dialogView->startIndexingDialog(this, enabledModes, info);
|
||||
dialogView->startIndexingDialog(this, enabledModes, info, [this, dialogView](const RefreshInfo& info) { buildIndex(info, dialogView); });
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -371,7 +371,7 @@ RefreshInfo Project::getRefreshInfo(RefreshMode mode) const
|
||||
}
|
||||
}
|
||||
|
||||
void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
void Project::buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> dialogView)
|
||||
{
|
||||
if (m_isIndexing)
|
||||
{
|
||||
|
||||
@@ -37,11 +37,11 @@ public:
|
||||
|
||||
void load();
|
||||
|
||||
void refresh(RefreshMode refreshMode, DialogView* dialogView);
|
||||
void refresh(RefreshMode refreshMode, std::shared_ptr<DialogView> dialogView);
|
||||
|
||||
RefreshInfo getRefreshInfo(RefreshMode mode) const;
|
||||
|
||||
void buildIndex(const RefreshInfo& info, DialogView* dialogView);
|
||||
void buildIndex(const RefreshInfo& info, std::shared_ptr<DialogView> dialogView);
|
||||
|
||||
private:
|
||||
enum ProjectStateType
|
||||
|
||||
@@ -145,7 +145,8 @@ void QtDialogView::hideProgressDialog()
|
||||
}
|
||||
|
||||
void QtDialogView::startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info)
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing)
|
||||
{
|
||||
m_refreshInfos.clear();
|
||||
|
||||
@@ -206,7 +207,7 @@ void QtDialogView::startIndexingDialog(
|
||||
Task::dispatch(std::make_shared<TaskLambda>(
|
||||
[=]()
|
||||
{
|
||||
project->buildIndex(info, this);
|
||||
onStartIndexing(info);
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ public:
|
||||
void hideProgressDialog() override;
|
||||
|
||||
void startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info) override;
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
|
||||
std::function<void(const RefreshInfo& info)> onStartIndexing) override;
|
||||
void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
|
||||
DatabasePolicy finishedIndexingDialog(
|
||||
|
||||
Reference in New Issue
Block a user