Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database locking issues in DB editor #3040

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion spinetoolbox/parameter_type_validation.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 3 additions & 2 deletions spinetoolbox/spine_db_editor/mvcmodels/single_models.py
Original file line number Diff line number Diff line change
@@ -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):