From 6d9c9600a2f5b24ffb276c4cf183bc81e815cccc Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 14 Feb 2016 01:22:44 +0200 Subject: [PATCH] Fixed: reloading cached image with style reload:1 hint --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 0140fab19..a0f65827e 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -579,9 +579,11 @@ namespace NLGUI string finalUrl; if (it->type == ImgType) { - CFile::moveFile(it->dest, tmpfile); - //if (lookupLocalFile (finalUrl, file.c_str(), false)) + // there is race condition if two browser instances are downloading same file + // second instance deletes first tmpfile and creates new file for itself. + if (CFile::getFileSize(tmpfile) > 0) { + CFile::moveFile(it->dest, tmpfile); for(uint i = 0; i < it->imgs.size(); i++) { setImage(it->imgs[i].Image, it->dest); @@ -3876,6 +3878,9 @@ namespace NLGUI // // 3/ if it doesn't work, display a placeholder and ask to dl the image into the cache // + if (reloadImg && CFile::fileExists(image)) + CFile::deleteFile(image); + image = "web_del.tga"; addImageDownload(img, newImage, style); }