From 16ca6e63f4fd1b407c826a5574dc20b3f9e71675 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 3 Nov 2020 01:07:57 +0100 Subject: Matrix: sync with filter, lazy member fetch (reducing sync time from 35 sec with huge server to 3 seconds) and cached fetch to 150ms). Properly show notifications for older messages. Reduce memory usage from 120mb to 13mb --- src/AsyncImageLoader.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/AsyncImageLoader.cpp') diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp index d3aa287..136bd5b 100644 --- a/src/AsyncImageLoader.cpp +++ b/src/AsyncImageLoader.cpp @@ -1,5 +1,6 @@ #include "../include/AsyncImageLoader.hpp" #include "../include/DownloadUtils.hpp" +#include "../include/Program.hpp" #include "../include/ImageUtils.hpp" #include "../include/Scale.hpp" #include "../include/SfmlFixes.hpp" @@ -130,13 +131,16 @@ namespace QuickMedia { AsyncImageLoader::~AsyncImageLoader() { image_load_queue.close(); - if(load_image_thread.joinable()) + if(load_image_thread.joinable()) { + program_kill_in_thread(load_image_thread.get_id()); load_image_thread.join(); + } - // TODO: Find a way to kill the threads instead. We need to do this right now because creating a new thread before the last one has died causes a crash for(size_t i = 0; i < NUM_IMAGE_LOAD_THREADS; ++i) { - if(download_image_thread[i].joinable()) + if(download_image_thread[i].joinable()) { + program_kill_in_thread(download_image_thread[i].get_id()); download_image_thread[i].join(); + } } } -- cgit v1.2.3