From 3c95de645a7adb05c1d6f7f58ce8062e8f2065f1 Mon Sep 17 00:00:00 2001 From: Michael Schuldt Date: Fri, 7 Dec 2012 14:29:51 +0200 Subject: [PATCH] X11EGLImage : Fixing memory leak - the compostion pixmap handle was not store internal - this causes a memory leak on surface destroy - this is now fixed. Signed-off-by: Michael Schuldt --- .../Renderers/Graphic/src/TextureBinders/X11EglImage.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp b/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp index 109fa30..ff15396 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp @@ -72,6 +72,8 @@ void X11EglImage::createClientBuffer(Surface* surface) if (windowPixmap == 0) { LOG_ERROR("X11EglImage", "didnt create pixmap!"); + } else { + nativeSurface->pixmap = windowPixmap; } EGLImageKHR eglImage = 0; @@ -114,6 +116,7 @@ PlatformSurface* X11EglImage::createPlatformSurface(Surface* surface) void X11EglImage::destroyClientBuffer(Surface* surface) { EglXPlatformSurface* nativeSurface = (EglXPlatformSurface*)surface->platform; + // We have to clean up the gpu texture memory if (nativeSurface && nativeSurface->eglImage) { m_pfEglDestroyImageKHR(m_eglDisplay, nativeSurface->eglImage); @@ -121,4 +124,10 @@ void X11EglImage::destroyClientBuffer(Surface* surface) nativeSurface->eglImage = 0; nativeSurface->texture = 0; } + // We have to clean up the XServer side pixmap too + if (nativeSurface && nativeSurface->pixmap ) + { + XFreePixmap(m_x11display, nativeSurface->pixmap); + nativeSurface->pixmap = None; + } } -- 2.7.4