From 74bf76d5239993d6c3f26803cc5742f358d4ff7a Mon Sep 17 00:00:00 2001 From: janwas Date: Mon, 31 Oct 2005 18:57:03 +0000 Subject: [PATCH] fix bug #71 - was a double-free (both ~CRenderer and UnloadResources were calling UnloadWaterTextures) This was SVN commit r3071. --- source/graphics/GameView.cpp | 1 + source/graphics/GameView.h | 2 +- source/lib/res/h_mgr.cpp | 2 +- source/renderer/Renderer.cpp | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/graphics/GameView.cpp b/source/graphics/GameView.cpp index 0e077b4e0c..ffcd5563a9 100755 --- a/source/graphics/GameView.cpp +++ b/source/graphics/GameView.cpp @@ -306,6 +306,7 @@ void CGameView::UnloadResources() // g_ObjMan.UnloadObjects(); g_Renderer.UnloadAlphaMaps(); + g_Renderer.UnloadWaterTextures(); } diff --git a/source/graphics/GameView.h b/source/graphics/GameView.h index 48a9121c44..413721a1f0 100755 --- a/source/graphics/GameView.h +++ b/source/graphics/GameView.h @@ -67,7 +67,7 @@ class CGameView: public CJSObject // InitResources(): Load all graphics resources (textures, actor objects and // alpha maps) required by the game - void InitResources(); + //void InitResources(); // UnloadResources(): Unload all graphics resources loaded by InitResources void UnloadResources(); diff --git a/source/lib/res/h_mgr.cpp b/source/lib/res/h_mgr.cpp index d1390c2b13..327c8b405f 100755 --- a/source/lib/res/h_mgr.cpp +++ b/source/lib/res/h_mgr.cpp @@ -747,7 +747,7 @@ static int h_free_idx(i32 idx, HDATA* hd) fn_free(hd); - memset(hd, 0, sizeof(HDATA)); + memset(hd, 0, sizeof(*hd)); free_idx(idx); diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index a305dff910..6b3f50b326 100755 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -167,8 +167,9 @@ CRenderer::~CRenderer() delete m_VertexShader; m_VertexShader = 0; - UnloadAlphaMaps(); - UnloadWaterTextures(); + // we no longer UnloadAlphaMaps / UnloadWaterTextures here - + // that is the responsibility of the module that asked for + // them to be loaded (i.e. CGameView). }