From ccb89261bd51e448124c462f289d43afcd9006de Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 3 May 2018 19:49:50 +0200 Subject: Fix freeze when gif has unlimited frame delay. If unlimited, set to 15 --- src/Cache.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/Cache.cpp') diff --git a/src/Cache.cpp b/src/Cache.cpp index 1c3261b..df97174 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -134,7 +134,7 @@ namespace dchat } catch(std::exception &e) { - + fprintf(stderr, "Failed to load image %s, reason: %s\n", filepath.string().c_str(), e.what()); } return { (sf::Texture*)nullptr, ImageByUrlResult::Type::FAILED_DOWNLOAD }; } @@ -162,14 +162,9 @@ namespace dchat imageDownloadMutex.lock(); imageUrlCache[it->url] = imageByUrlResult; imageDownloadMutex.unlock(); - switch(imageByUrlResult.type) + if(imageByUrlResult.type == ImageByUrlResult::Type::CACHED) { - case ImageByUrlResult::Type::CACHED: - printf("Downloaded image from url: %s\n", it->url.c_str()); - break; - case ImageByUrlResult::Type::FAILED_DOWNLOAD: - printf("Failed to download and load image from url: %s\n", it->url.c_str()); - break; + printf("Download %s from url: %s\n", imageByUrlResult.isGif ? "gif" : "image", it->url.c_str()); } } it = imageDownloadProcesses.erase(it); -- cgit v1.2.3