aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2018-09-12 21:04:29 +0800
committerGitHub <noreply@github.com>2018-09-12 21:04:29 +0800
commit1e78ca6b9c09cb16677ab3db1656085adbd4901b (patch)
tree633a6e8fe8a244b44b510b608ec3103431a0e042 /lib/connection.cpp
parent79f338877dec3de5ec7394f190025395877cb00b (diff)
parent2a1596c16baad77fc80391c66694101f91028deb (diff)
downloadlibquotient-1e78ca6b9c09cb16677ab3db1656085adbd4901b.tar.gz
libquotient-1e78ca6b9c09cb16677ab3db1656085adbd4901b.zip
Merge pull request #1 from QMatrixClient/master
Merge to latest commit.
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 8d55460d..cf3446ff 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -649,14 +649,14 @@ ForgetRoomJob* Connection::forgetRoom(const QString& id)
forgetJob->start(connectionData());
connect(forgetJob, &BaseJob::success, this, [this, id]
{
- // If the room is in the map (possibly in both forms), delete all forms.
+ // Delete whatever instances of the room are still in the map.
for (auto f: {false, true})
if (auto r = d->roomMap.take({ id, f }))
{
- emit aboutToDeleteRoom(r);
- qCDebug(MAIN) << "Room" << id
- << "in join state" << toCString(r->joinState())
+ qCDebug(MAIN) << "Room" << r->objectName()
+ << "in state" << toCString(r->joinState())
<< "will be deleted";
+ emit r->beforeDestruction(r);
r->deleteLater();
}
});
@@ -995,6 +995,8 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
}
d->roomMap.insert(roomKey, room);
d->firstTimeRooms.push_back(room);
+ connect(room, &Room::beforeDestruction,
+ this, &Connection::aboutToDeleteRoom);
emit newRoom(room);
}
if (joinState == JoinState::Invite)
@@ -1015,7 +1017,7 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
if (prevInvite)
{
qCDebug(MAIN) << "Deleting Invite state for room" << prevInvite->id();
- emit aboutToDeleteRoom(prevInvite);
+ emit prevInvite->beforeDestruction(prevInvite);
prevInvite->deleteLater();
}
}