From 33af150e231f722b6b5659dc5ee1092b146568be Mon Sep 17 00:00:00 2001 From: ac-stef Date: Fri, 12 May 2017 13:49:23 +0200 Subject: [PATCH] fix menu texture preview updates it was kind of naive to hope, that newstrings would not reuse the exact same freed memory that was used for the last string at least sometimes... --- source/src/menus.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index a27d7110..ea9e8e5c 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -1451,14 +1451,15 @@ FVAR(menupicturesize, 0.1f, 1.6f, 5.0f); void rendermenutexturepreview(char *previewtexture, int w, const char *title) { static Texture *pt = NULL; - static char *last_pt = NULL; + static uint last_pt = 0; bool ispicture = title != NULL; - if(previewtexture != last_pt) + uint cur_pt = hthash(previewtexture); + if(cur_pt != last_pt) { silent_texture_load = ispicture; defformatstring(texpath)("packages/textures/%s", previewtexture); pt = textureload(texpath, ispicture ? 3 : 0); - last_pt = previewtexture; + last_pt = cur_pt; silent_texture_load = false; } if(pt && pt != notexture && pt->xs && pt->ys)