aboutsummaryrefslogtreecommitdiffstats
path: root/gui/treemodel.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/treemodel.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/treemodel.cc')
-rw-r--r--gui/treemodel.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gui/treemodel.cc b/gui/treemodel.cc
index 4fc3d4f5..bf7d81a3 100644
--- a/gui/treemodel.cc
+++ b/gui/treemodel.cc
@@ -146,6 +146,7 @@ void Model::loadContext(Context *ctx)
{
if (!ctx)
return;
+ ctx_ = ctx;
beginResetModel();
@@ -273,6 +274,12 @@ Qt::ItemFlags Model::flags(const QModelIndex &index) const
void Model::fetchMore(const QModelIndex &parent)
{
+ if (ctx_ == nullptr)
+ return;
+
+ std::lock_guard<std::mutex> lock_ui(ctx_->ui_mutex);
+ std::lock_guard<std::mutex> lock(ctx_->mutex);
+
nodeFromIndex(parent)->fetchMore();
}
@@ -284,7 +291,6 @@ bool Model::canFetchMore(const QModelIndex &parent) const
QList<QModelIndex> Model::search(QString text)
{
const int limit = 500;
-
QList<Item*> list;
cell_root_->search(list, text, limit);
net_root_->search(list, text, limit);