Skip to content

Commit

Permalink
Fix database locking issues in DB editor
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Jan 31, 2025
1 parent f129273 commit 954cf69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion spinetoolbox/parameter_type_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def start_validating(self, db_mngr, db_map, value_item_ids):
if not self._process.is_alive():
self._process.start()
for item_id in value_item_ids:
item = db_mngr.get_item(db_map, item_id.item_type, item_id)
with db_mngr.get_lock(db_map):
item = db_mngr.get_item(db_map, item_id.item_type, item_id)
args = type_check_args(item)
self._task_queue.append(
ValidatableValue(ValidationKey(item_id.item_type, id(db_map), item_id.private_id), args)
Expand Down
5 changes: 3 additions & 2 deletions spinetoolbox/spine_db_editor/mvcmodels/single_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ def data(self, index, role=Qt.ItemDataRole.DisplayRole):
PARAMETER_TYPE_VALIDATION_ROLE,
}:
id_ = self._main_data[index.row()]
item = self.db_mngr.get_item(self.db_map, self.item_type, id_)
return self.db_mngr.get_value(self.db_map, item, role)
with self.db_mngr.get_lock(self.db_map):
item = self.db_mngr.get_item(self.db_map, self.item_type, id_)
return self.db_mngr.get_value(self.db_map, item, role)
return super().data(index, role)

def add_rows(self, ids):
Expand Down

0 comments on commit 954cf69

Please sign in to comment.