diff options
Diffstat (limited to 'src/AsyncImageLoader.cpp')
-rw-r--r-- | src/AsyncImageLoader.cpp | 10 |
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(); + } } } |