Skip to content
Snippets Groups Projects
Commit 9f42301b authored by Sébastien Blin's avatar Sébastien Blin
Browse files

devicemodel: do not lock when emitting signal

This can cause a deadlock, also use onAccepted to avoid
sporadic changes

Change-Id: Ic7ff97b7e8fdd64da981eaf0b3148edd6d4eccd6
GitLab: #1011
parent b9f2ebd1
Branches
Tags
No related merge requests found
...@@ -89,7 +89,7 @@ ItemDelegate { ...@@ -89,7 +89,7 @@ ItemDelegate {
loseFocusWhenEnterPressed: true loseFocusWhenEnterPressed: true
backgroundColor: JamiTheme.transparentColor backgroundColor: JamiTheme.transparentColor
onEditingFinished: { onAccepted: {
AvAdapter.setDeviceName(editDeviceName.text) AvAdapter.setDeviceName(editDeviceName.text)
editable = !editable editable = !editable
} }
......
...@@ -105,12 +105,12 @@ DeviceModel::setCurrentDeviceName(const QString& newName) ...@@ -105,12 +105,12 @@ DeviceModel::setCurrentDeviceName(const QString& newName)
config.deviceName = newName; config.deviceName = newName;
owner.accountModel->setAccountConfig(owner.id, config); owner.accountModel->setAccountConfig(owner.id, config);
// Update model // Update model
std::lock_guard<std::mutex> lock(pimpl_->devicesMtx_); std::unique_lock<std::mutex> lock(pimpl_->devicesMtx_);
for (auto& device : pimpl_->devices_) { for (auto& device : pimpl_->devices_) {
if (device.id == config.deviceId) { if (device.id == config.deviceId) {
device.name = newName; device.name = newName;
lock.unlock();
Q_EMIT deviceUpdated(device.id); Q_EMIT deviceUpdated(device.id);
return; return;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment