aboutsummaryrefslogtreecommitdiff
path: root/include/AsyncImageLoader.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-18 06:54:18 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-18 06:54:18 +0200
commitf5dc7e2c85436877606af46a011c2fba112185a9 (patch)
tree04dfdc46a1faf7b3187e284a45075260d3f25e02 /include/AsyncImageLoader.hpp
parent7e1a950a0be2871045e0dda6ba2adc892d323464 (diff)
Fix potential crash in thumbnail loader: 2
Diffstat (limited to 'include/AsyncImageLoader.hpp')
-rw-r--r--include/AsyncImageLoader.hpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/AsyncImageLoader.hpp b/include/AsyncImageLoader.hpp
index fe8d52a..fa32971 100644
--- a/include/AsyncImageLoader.hpp
+++ b/include/AsyncImageLoader.hpp
@@ -4,7 +4,7 @@
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <memory>
-#include <future>
+#include <thread>
namespace QuickMedia {
enum class LoadingState {
@@ -23,15 +23,13 @@ namespace QuickMedia {
class AsyncImageLoader {
public:
- ~AsyncImageLoader();
// Returns false if the image loader is already loading an image. In that case, this function should be called again later.
// set |resize_target_size| to {0, 0} to disable resizing.
// |thumbnail_data.loading_state| has to be LoadingState::NOT_LOADED when calling this!
// Note: this method is not thread-safe
bool load_thumbnail(const std::string &url, bool local, sf::Vector2i resize_target_size, bool use_tor, std::shared_ptr<ThumbnailData> thumbnail_data);
- void update();
private:
bool loading_image = false;
- std::future<void> load_image_future;
+ std::thread load_image_thread;
};
} \ No newline at end of file