forked from qt-creator/qt-creator
Axivion: Fix a possible crash when rerunning task tree from its handler
Don't call setTableDto() directly from tableInfoRecipe's handler. Store the new table dto in the handler and update the Gui afterwards, on task tree done. Fixes: QTCREATORBUG-30429 Change-Id: Id267c8375bf7c9a107450ac34ecba37d696f45e1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -229,15 +229,15 @@ class IssuesWidget : public QScrollArea
|
|||||||
public:
|
public:
|
||||||
explicit IssuesWidget(QWidget *parent = nullptr);
|
explicit IssuesWidget(QWidget *parent = nullptr);
|
||||||
void updateUi();
|
void updateUi();
|
||||||
void setTableDto(const Dto::TableInfoDto &dto);
|
void updateTable();
|
||||||
void addIssues(const Dto::IssueTableDto &dto);
|
void addIssues(const Dto::IssueTableDto &dto);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onSearchParameterChanged();
|
void onSearchParameterChanged();
|
||||||
void updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info);
|
void updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info);
|
||||||
void updateTableView();
|
|
||||||
void setFiltersEnabled(bool enabled);
|
void setFiltersEnabled(bool enabled);
|
||||||
IssueListSearch searchFromUi() const;
|
IssueListSearch searchFromUi() const;
|
||||||
|
void fetchTable();
|
||||||
void fetchIssues(const IssueListSearch &search);
|
void fetchIssues(const IssueListSearch &search);
|
||||||
void fetchMoreIssues();
|
void fetchMoreIssues();
|
||||||
|
|
||||||
@@ -360,18 +360,19 @@ void IssuesWidget::updateUi()
|
|||||||
|
|
||||||
if (info.issueKinds.size())
|
if (info.issueKinds.size())
|
||||||
m_currentPrefix = info.issueKinds.front().prefix;
|
m_currentPrefix = info.issueKinds.front().prefix;
|
||||||
updateTableView();
|
fetchTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IssuesWidget::setTableDto(const Dto::TableInfoDto &dto)
|
void IssuesWidget::updateTable()
|
||||||
{
|
{
|
||||||
m_currentTableInfo.emplace(dto);
|
if (!m_currentTableInfo)
|
||||||
|
return;
|
||||||
|
|
||||||
// update issues table layout - for now just simple approach
|
// update issues table layout - for now just simple approach
|
||||||
TreeModel<> *issuesModel = new TreeModel(this);
|
TreeModel<> *issuesModel = new TreeModel(this);
|
||||||
QStringList columnHeaders;
|
QStringList columnHeaders;
|
||||||
QStringList hiddenColumns;
|
QStringList hiddenColumns;
|
||||||
for (const Dto::ColumnInfoDto &column : dto.columns) {
|
for (const Dto::ColumnInfoDto &column : m_currentTableInfo->columns) {
|
||||||
columnHeaders << column.header.value_or(column.key);
|
columnHeaders << column.header.value_or(column.key);
|
||||||
if (!column.showByDefault)
|
if (!column.showByDefault)
|
||||||
hiddenColumns << column.key;
|
hiddenColumns << column.key;
|
||||||
@@ -511,7 +512,7 @@ void IssuesWidget::updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> inf
|
|||||||
button->setCheckable(true);
|
button->setCheckable(true);
|
||||||
connect(button, &QToolButton::clicked, this, [this, prefix = kind.prefix]{
|
connect(button, &QToolButton::clicked, this, [this, prefix = kind.prefix]{
|
||||||
m_currentPrefix = prefix;
|
m_currentPrefix = prefix;
|
||||||
updateTableView();
|
fetchTable();
|
||||||
});
|
});
|
||||||
m_typesButtonGroup->addButton(button, ++buttonId);
|
m_typesButtonGroup->addButton(button, ++buttonId);
|
||||||
m_typesLayout->addWidget(button);
|
m_typesLayout->addWidget(button);
|
||||||
@@ -543,20 +544,26 @@ void IssuesWidget::updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> inf
|
|||||||
m_versionStart->setCurrentIndex(m_versionDates.count() - 1);
|
m_versionStart->setCurrentIndex(m_versionDates.count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IssuesWidget::updateTableView()
|
void IssuesWidget::fetchTable()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_currentPrefix.isEmpty(), return);
|
QTC_ASSERT(!m_currentPrefix.isEmpty(), return);
|
||||||
// fetch table dto and apply, on done fetch first data for the selected issues
|
// fetch table dto and apply, on done fetch first data for the selected issues
|
||||||
const auto tableHandler = [this](const Dto::TableInfoDto &dto) { setTableDto(dto); };
|
const auto tableHandler = [this](const Dto::TableInfoDto &dto) {
|
||||||
const auto setupHandler = [this](TaskTree *) { m_issuesView->showProgressIndicator(); };
|
m_currentTableInfo.emplace(dto);
|
||||||
|
};
|
||||||
|
const auto setupHandler = [this](TaskTree *) {
|
||||||
|
m_totalRowCount = 0;
|
||||||
|
m_lastRequestedOffset = 0;
|
||||||
|
m_currentTableInfo.reset();
|
||||||
|
m_issuesView->showProgressIndicator();
|
||||||
|
};
|
||||||
const auto doneHandler = [this](DoneWith result) {
|
const auto doneHandler = [this](DoneWith result) {
|
||||||
if (result == DoneWith::Error) {
|
if (result == DoneWith::Error) {
|
||||||
m_issuesView->hideProgressIndicator();
|
m_issuesView->hideProgressIndicator();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// first time lookup... should we cache and maybe represent old data?
|
// first time lookup... should we cache and maybe represent old data?
|
||||||
m_totalRowCount = 0;
|
updateTable();
|
||||||
m_lastRequestedOffset = 0;
|
|
||||||
IssueListSearch search = searchFromUi();
|
IssueListSearch search = searchFromUi();
|
||||||
search.computeTotalRowCount = true;
|
search.computeTotalRowCount = true;
|
||||||
fetchIssues(search);
|
fetchIssues(search);
|
||||||
|
|||||||
Reference in New Issue
Block a user