Commit 5c635ab5 authored by Ronan's avatar Ronan

fix(core-chat-room): add a workaround to deal with destroyed chat rooms

parent 37011a27
......@@ -254,8 +254,18 @@ void Core::deleteChatRoom (const shared_ptr<const AbstractChatRoom> &chatRoom) {
const ChatRoomId &chatRoomId = chatRoom->getChatRoomId();
auto it = d->chatRoomsById.find(chatRoomId);
if (it != d->chatRoomsById.end()) {
auto it = find(d->chatRooms.begin(), d->chatRooms.end(), chatRoom);
L_ASSERT(it != d->chatRooms.end());
// TODO: Remove me later.
auto it = find_if(
d->chatRooms.begin(), d->chatRooms.end(),
[&chatRoomId](const shared_ptr<AbstractChatRoom> &chatRoom) {
return chatRoom->getChatRoomId() == chatRoomId;
}
);
// FIXME: Use this code in the future. (Wait for signals.)
// auto it = find(d->chatRooms.begin(), d->chatRooms.end(), chatRoom);
// L_ASSERT(it != d->chatRooms.end());
d->chatRooms.erase(it);
d->mainDb->deleteChatRoom(chatRoomId);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment