aboutsummaryrefslogtreecommitdiff
path: root/src/AsyncImageLoader.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-03 01:07:57 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-03 01:07:57 +0100
commit16ca6e63f4fd1b407c826a5574dc20b3f9e71675 (patch)
tree3dbe065229dc130f0a49134bfeeb35ad11d01958 /src/AsyncImageLoader.cpp
parent7045953e428076b0f07dc8043a5a1a0ac3d4bec5 (diff)
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
Diffstat (limited to 'src/AsyncImageLoader.cpp')
-rw-r--r--src/AsyncImageLoader.cpp10
1 files changed, 7 insertions, 3 deletions
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();
+ }
}
}