diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-04-06 20:32:09 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-04-06 20:32:50 +0900 |
commit | c36341512560cedf063279848fa43c44b146161b (patch) | |
tree | 0701f957c3701aae73f93f44edb97d5c01e44190 /lib | |
parent | a10a06052aa3f85f937844cb72f8775712e4299b (diff) | |
download | libquotient-c36341512560cedf063279848fa43c44b146161b.tar.gz libquotient-c36341512560cedf063279848fa43c44b146161b.zip |
Room::processStateEvent: be more careful with signals handling at user renames
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index f031273a..e363767a 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1216,7 +1216,6 @@ void Room::Private::renameMember(User* u, const QString& oldName) removeMemberFromMap(oldName, u); insertMemberIntoMap(u); } - emit q->memberRenamed(u); } void Room::Private::removeMemberFromMap(const QString& username, User* u) @@ -2237,6 +2236,8 @@ Room::Changes Room::processStateEvent(const RoomEvent& e) << evt; if (evt.membership() != prevMembership) { + disconnect(u, &User::nameAboutToChange, this, nullptr); + disconnect(u, &User::nameChanged, this, nullptr); d->removeMemberFromMap(u->name(this), u); emit userRemoved(u); } @@ -2264,7 +2265,10 @@ Room::Changes Room::processStateEvent(const RoomEvent& e) connect(u, &User::nameChanged, this, [=] (QString, QString oldName, const Room* context) { if (context == this) + { d->renameMember(u, oldName); + emit memberRenamed(u); + } }); emit userAdded(u); } |