aboutsummaryrefslogtreecommitdiffstats
path: root/gui/designwidget.cc
diff options
context:
space:
mode:
authorSergiusz Bazanski <q3k@q3k.org>2018-08-01 03:26:27 +0100
committerSergiusz Bazanski <q3k@q3k.org>2018-08-01 03:26:27 +0100
commitf9d30bcdea72e4860361d8ab350282703dc3bfcf (patch)
treeb15967aea47806335a5811dfc934260c39367319 /gui/designwidget.cc
parent9fb9eab6c9699df5cd86ca03563e0fa871defb83 (diff)
downloadnextpnr-f9d30bcdea72e4860361d8ab350282703dc3bfcf.tar.gz
nextpnr-f9d30bcdea72e4860361d8ab350282703dc3bfcf.tar.bz2
nextpnr-f9d30bcdea72e4860361d8ab350282703dc3bfcf.zip
gui: lock arch when accessing/building treemodel
Diffstat (limited to 'gui/designwidget.cc')
-rw-r--r--gui/designwidget.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/gui/designwidget.cc b/gui/designwidget.cc
index c75991eb..34e358ae 100644
--- a/gui/designwidget.cc
+++ b/gui/designwidget.cc
@@ -215,7 +215,11 @@ void DesignWidget::newContext(Context *ctx)
highlightSelected.clear();
this->ctx = ctx;
- treeModel->loadContext(ctx);
+ {
+ std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
+ std::lock_guard<std::mutex> lock(ctx->mutex);
+ treeModel->loadContext(ctx);
+ }
updateTree();
}
@@ -235,7 +239,11 @@ void DesignWidget::updateTree()
}
}
- treeModel->updateCellsNets(ctx);
+ {
+ std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
+ std::lock_guard<std::mutex> lock(ctx->mutex);
+ treeModel->updateCellsNets(ctx);
+ }
}
QtProperty *DesignWidget::addTopLevelProperty(const QString &id)
{
@@ -735,6 +743,9 @@ void DesignWidget::onSearchInserted()
if (currentIndex >= currentSearchIndexes.size())
currentIndex = 0;
} else {
+ std::lock_guard<std::mutex> lock_ui(ctx->ui_mutex);
+ std::lock_guard<std::mutex> lock(ctx->mutex);
+
currentSearch = searchEdit->text();
currentSearchIndexes = treeModel->search(searchEdit->text());
currentIndex = 0;