1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 23:05:48 +02:00

devicemodel: do not lock when emitting signal

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

Change-Id: Ic7ff97b7e8fdd64da981eaf0b3148edd6d4eccd6
GitLab: #1011
This commit is contained in:
Sébastien Blin 2023-03-01 15:56:26 -05:00
parent b9f2ebd1a5
commit 9f42301b5c
2 changed files with 3 additions and 3 deletions

View file

@ -89,7 +89,7 @@ ItemDelegate {
loseFocusWhenEnterPressed: true
backgroundColor: JamiTheme.transparentColor
onEditingFinished: {
onAccepted: {
AvAdapter.setDeviceName(editDeviceName.text)
editable = !editable
}

View file

@ -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;
}
}