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