From c268f60339429a5c52b08dd18c55e06cbd1ccda8 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 4 Oct 2010 23:03:13 +0000 Subject: [PATCH] Fix a memory leak in projectm when using the non-FBO fallback on Windows Vista. Fixes issue #846 --- 3rdparty/libprojectm/Renderer/FBO.cpp | 5 ++++- .../07-fix-fbo-fallback-memory-leak.patch | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 3rdparty/libprojectm/patches/07-fix-fbo-fallback-memory-leak.patch diff --git a/3rdparty/libprojectm/Renderer/FBO.cpp b/3rdparty/libprojectm/Renderer/FBO.cpp index 97e482a85..2d2e2d5bc 100755 --- a/3rdparty/libprojectm/Renderer/FBO.cpp +++ b/3rdparty/libprojectm/Renderer/FBO.cpp @@ -187,7 +187,10 @@ RenderTarget::RenderTarget(int texsize, int width, int height) : useFBO(false) { { int mindim = width < height ? width : height; int origtexsize = this->texsize; - this->texsize = nearestPower2( mindim, SCALE_MINIFY ); + this->texsize = nearestPower2( mindim, SCALE_MINIFY ); + + if (origtexsize == texsize) + return; /* Create the texture that will be bound to the render this */ /* diff --git a/3rdparty/libprojectm/patches/07-fix-fbo-fallback-memory-leak.patch b/3rdparty/libprojectm/patches/07-fix-fbo-fallback-memory-leak.patch new file mode 100644 index 000000000..1c6bd4ec5 --- /dev/null +++ b/3rdparty/libprojectm/patches/07-fix-fbo-fallback-memory-leak.patch @@ -0,0 +1,17 @@ +Index: Renderer/FBO.cpp +=================================================================== +--- Renderer/FBO.cpp (revision 2090) ++++ Renderer/FBO.cpp (working copy) +@@ -187,8 +187,11 @@ + { + int mindim = width < height ? width : height; + int origtexsize = this->texsize; +- this->texsize = nearestPower2( mindim, SCALE_MINIFY ); ++ this->texsize = nearestPower2( mindim, SCALE_MINIFY ); + ++ if (origtexsize == texsize) ++ return; ++ + /* Create the texture that will be bound to the render this */ + /* +