Erase items using the key

This commit is contained in:
Konstantinos Sideris 2018-01-25 14:34:15 +02:00
parent 936e215aed
commit 0e91dae922
6 changed files with 7 additions and 12 deletions

View file

@ -20,7 +20,7 @@ public:
void clear() { communities_.clear(); }
void addCommunity(QSharedPointer<Community> community, const QString &id);
void removeCommunity(const QString &id);
void removeCommunity(const QString &id) { communities_.erase(id); };
signals:
void communityChanged(const QString &id);

View file

@ -39,7 +39,7 @@ AvatarProvider::updateAvatar(const QString &uid, const QImage &img)
for (const auto callback : callbacks)
callback(img);
toBeResolved_.erase(toBeResolved_.find(uid));
toBeResolved_.erase(uid);
}
auto avatarData = avatars_[uid];

View file

@ -761,8 +761,9 @@ ChatPage::addRoom(const QString &room_id)
void
ChatPage::removeRoom(const QString &room_id)
{
roomStates_.erase(roomStates_.find(room_id));
roomSettings_.erase(roomSettings_.find(room_id));
roomStates_.erase(room_id);
roomSettings_.erase(room_id);
try {
cache_->removeRoom(room_id);
cache_->removeInvite(room_id);

View file

@ -100,12 +100,6 @@ CommunitiesList::addCommunity(QSharedPointer<Community> community, const QString
&CommunitiesList::highlightSelectedCommunity);
}
void
CommunitiesList::removeCommunity(const QString &community_id)
{
communities_.erase(communities_.find(community_id));
}
void
CommunitiesList::updateCommunityAvatar(const QString &community_id, const QPixmap &img)
{

View file

@ -123,7 +123,7 @@ RoomList::updateAvatar(const QString &room_id, const QString &url)
void
RoomList::removeRoom(const QString &room_id, bool reset)
{
rooms_.erase(rooms_.find(room_id));
rooms_.erase(room_id);
if (rooms_.empty() || !reset)
return;

View file

@ -157,7 +157,7 @@ RoomState::update(const RoomState &state)
}
if (membershipState == mtx::events::state::Membership::Leave)
this->memberships.erase(this->memberships.find(it->first));
this->memberships.erase(it->first);
else
this->memberships.emplace(it->first, it->second);
}