diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h
index 1449bf2c9..de94e29ff 100644
--- a/nel/include/nel/gui/group_html.h
+++ b/nel/include/nel/gui/group_html.h
@@ -972,6 +972,7 @@ namespace NLGUI
// stop all curl downalods (html and data)
void releaseDownloads();
+ void releaseDataDownloads();
void checkDownloads();
// _CurlWWW download finished
diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp
index 55aeaec82..de1215d8d 100644
--- a/nel/src/gui/group_html.cpp
+++ b/nel/src/gui/group_html.cpp
@@ -299,6 +299,11 @@ namespace NLGUI
void CGroupHTML::ImageDownloadCB::finish()
{
+ // Image setTexture will remove itself from Images while iterating over it.
+ // Do the swap to keep iterator safe.
+ std::vector vec;
+ vec.swap(Images);
+
// tmpdest file does not exist if download skipped (ie cache was used)
if (CFile::fileExists(tmpdest) || CFile::getFileSize(tmpdest) == 0)
{
@@ -322,7 +327,7 @@ namespace NLGUI
// to temp file temporarily. that forces driver to reload texture from disk
// ITexture::touch() seem not to do this.
// cache was updated, first set texture as temp file
- for(std::vector::iterator it = Images.begin(); it != Images.end(); ++it)
+ for(std::vector::iterator it = vec.begin(); it != vec.end(); ++it)
{
SImageInfo &img = *it;
Parent->setImage(img.Image, tmpdest, img.Type);
@@ -339,7 +344,7 @@ namespace NLGUI
}
// even if image was cached, incase there was 'http://' image set to CViewBitmap
- for(std::vector::iterator it = Images.begin(); it != Images.end(); ++it)
+ for(std::vector::iterator it = vec.begin(); it != vec.end(); ++it)
{
SImageInfo &img = *it;
Parent->setImage(img.Image, dest, img.Type);
@@ -1056,6 +1061,13 @@ namespace NLGUI
_CurlWWW = NULL;
}
+ releaseDataDownloads();
+ }
+
+ void CGroupHTML::releaseDataDownloads()
+ {
+ LOG_DL("Clear pointers to %d curls", Curls.size());
+
// remove all queued and already started downloads
for(std::list::iterator it = Curls.begin(); it != Curls.end(); ++it)
{
@@ -3083,14 +3095,7 @@ namespace NLGUI
paragraphChange ();
- // clear the pointer to the current image download since all the button are deleted
- LOG_DL("Clear pointers to %d curls", Curls.size());
-
- // remove image refs from downloads
- /*for(std::list::iterator it = Curls.begin(); it != Curls.end(); ++it)
- {
- it->imgs.clear();
- }*/
+ releaseDataDownloads();
}
// ***************************************************************************
diff --git a/nel/src/gui/view_bitmap.cpp b/nel/src/gui/view_bitmap.cpp
index 89c944a18..1896ced40 100644
--- a/nel/src/gui/view_bitmap.cpp
+++ b/nel/src/gui/view_bitmap.cpp
@@ -481,7 +481,13 @@ namespace NLGUI
}
else
{
- _HtmlDownload = NULL;
+ if (_HtmlDownload)
+ {
+ CGroupHTML *groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html"));
+ if (groupHtml)
+ groupHtml->removeImageDownload(_HtmlDownload, dynamic_cast(this));
+ _HtmlDownload = NULL;
+ }
_TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false);
}
}