diff options
author | Sergiusz Bazanski <q3k@q3k.org> | 2018-08-01 03:26:27 +0100 |
---|---|---|
committer | Sergiusz Bazanski <q3k@q3k.org> | 2018-08-01 03:26:27 +0100 |
commit | f9d30bcdea72e4860361d8ab350282703dc3bfcf (patch) | |
tree | b15967aea47806335a5811dfc934260c39367319 /gui/designwidget.cc | |
parent | 9fb9eab6c9699df5cd86ca03563e0fa871defb83 (diff) | |
download | nextpnr-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.cc | 15 |
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;
|