diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-16 14:48:26 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-16 14:48:26 +0100 |
commit | 4e3a32ea4478e547215c6775313aaded3bc16b08 (patch) | |
tree | 12a01077e0d2997663995d7c56648e15c74cba93 /src | |
parent | 4eeaa5c2b889a22c23199247ccc87fb717e6cbcb (diff) |
Matrix: do not continuously fetch messages when currently showing pinned messages tab
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 3 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index df2d63e..315fef0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -4569,7 +4569,8 @@ namespace QuickMedia { window.display(); - fetch_more_previous_messages_if_needed(); + if(selected_tab == MESSAGES_TAB_INDEX) + fetch_more_previous_messages_if_needed(); if(matrix_chat_page->should_clear_data) { matrix_chat_page->should_clear_data = false; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index b102cfa..9da6185 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -274,6 +274,7 @@ namespace QuickMedia { void RoomData::clear_data() { std::lock_guard<std::recursive_mutex> lock(room_mutex); //fetched_messages_by_event_id.clear(); + userdata = nullptr; user_info_by_user_id.clear(); messages.clear(); messages_read_index = 0; @@ -460,7 +461,9 @@ namespace QuickMedia { last_unread_message = last_new_message.get(); BodyItem *room_body_item = static_cast<BodyItem*>(room->userdata); - assert(room_body_item); + //assert(room_body_item); + if(!room_body_item) + return; if(last_unread_message) { std::string room_desc = "Unread: " + matrix->message_get_author_displayname(last_unread_message) + ": " + extract_first_line_elipses(last_unread_message->body, 150); |