fix crash on friend update

This commit is contained in:
Gaelle Braud 2025-01-10 10:30:24 +01:00
parent db35d67a70
commit f6c3fc3252
4 changed files with 12 additions and 13 deletions

View file

@ -566,7 +566,7 @@ void FriendCore::writeIntoModel(std::shared_ptr<FriendModel> model) const {
model->setJob(mJob); model->setJob(mJob);
model->setPictureUri(mPictureUri); model->setPictureUri(mPictureUri);
model->getFriend()->done(); model->getFriend()->done();
emit CoreModel::getInstance()->friendUpdated(model->getFriend()); emit model->friendUpdated();
} }
void FriendCore::writeFromModel(const std::shared_ptr<FriendModel> &model) { void FriendCore::writeFromModel(const std::shared_ptr<FriendModel> &model) {

View file

@ -66,7 +66,6 @@ public:
signals: signals:
void loggerInitialized(); void loggerInitialized();
void friendCreated(const std::shared_ptr<linphone::Friend> &f); void friendCreated(const std::shared_ptr<linphone::Friend> &f);
void friendUpdated(const std::shared_ptr<linphone::Friend> &f);
void friendRemoved(const std::shared_ptr<linphone::Friend> &f); void friendRemoved(const std::shared_ptr<linphone::Friend> &f);
void conferenceInfoCreated(const std::shared_ptr<linphone::ConferenceInfo> &confInfo); void conferenceInfoCreated(const std::shared_ptr<linphone::ConferenceInfo> &confInfo);
void unreadNotificationsChanged(); void unreadNotificationsChanged();

View file

@ -56,9 +56,8 @@ FriendModel::FriendModel(const std::shared_ptr<linphone::Friend> &contact, const
}; };
connect(this, &FriendModel::givenNameChanged, updateFullName); connect(this, &FriendModel::givenNameChanged, updateFullName);
connect(this, &FriendModel::familyNameChanged, updateFullName); connect(this, &FriendModel::familyNameChanged, updateFullName);
connect(CoreModel::getInstance().get(), &CoreModel::friendUpdated, connect(this, &FriendModel::friendUpdated, [this]() {
[this](const std::shared_ptr<linphone::Friend> &f) { if (mMonitor) {
if (f == mMonitor) {
emit givenNameChanged(getGivenName()); emit givenNameChanged(getGivenName());
emit familyNameChanged(getFamilyName()); emit familyNameChanged(getFamilyName());
emit organizationChanged(getOrganization()); emit organizationChanged(getOrganization());

View file

@ -98,6 +98,7 @@ signals:
void organizationChanged(const QString &orga); void organizationChanged(const QString &orga);
void jobChanged(const QString &job); void jobChanged(const QString &job);
void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp); void presenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp);
void friendUpdated();
private: private:
DECLARE_ABSTRACT_OBJECT DECLARE_ABSTRACT_OBJECT