From 860023678f49c88272023a0f5e6ae94e853dba45 Mon Sep 17 00:00:00 2001 From: Sukwon Suh Date: Thu, 24 Oct 2013 15:03:32 +0900 Subject: [PATCH] fix memleak for emulator Change-Id: I0087df7e136e7a45c9676fa1f224b6d3ef5950e8 Signed-off-by: Sukwon Suh --- src/graphics/opengl/FGrpEgl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/graphics/opengl/FGrpEgl.cpp b/src/graphics/opengl/FGrpEgl.cpp index f829183..1c7195f 100644 --- a/src/graphics/opengl/FGrpEgl.cpp +++ b/src/graphics/opengl/FGrpEgl.cpp @@ -1622,8 +1622,8 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI Display* pNativeDisplay = null; Drawable nativeWindow = 0; Tizen::Graphics::_BitmapImpl* pBitmapImpl = null; - _PixmapInfo* pPixmapInfo = null; #if defined(FGRAPHICS_INTERNAL_USE_DRM) + _PixmapInfo* pPixmapInfo = null; unsigned int attachments[] = { DRI2BufferFrontLeft }; char* pDeviceName = null; char* pDriverName = null; @@ -1660,6 +1660,7 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI pNativeDisplay = (Display*) ecore_x_display_get(); nativeWindow = DefaultRootWindow(pNativeDisplay); +#if defined(FGRAPHICS_INTERNAL_USE_DRM) pPixmapInfo = new (std::nothrow) _PixmapInfo; if (pPixmapInfo == null) { @@ -1673,7 +1674,6 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI goto CATCH_02; } -#if defined(FGRAPHICS_INTERNAL_USE_DRM) DRI2CreateDrawable(pNativeDisplay, pPixmapInfo->nativePixmap); XSync(pNativeDisplay, False); @@ -1741,9 +1741,12 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI { goto CATCH_06; } -#endif //#if defined(FGRAPHICS_INTERNAL_USE_DRM) return (EGLNativePixmapType)pPixmapInfo->nativePixmap; +#else + return (EGLNativePixmapType)XCreatePixmap(pNativeDisplay, nativeWindow, width, height, bitsPerPixel); +#endif //#if defined(FGRAPHICS_INTERNAL_USE_DRM) + #if defined(FGRAPHICS_INTERNAL_USE_DRM) CATCH_06: @@ -1763,11 +1766,11 @@ CATCH_03: DRI2DestroyDrawable(pNativeDisplay, pPixmapInfo->nativePixmap); XFreePixmap(pNativeDisplay, pPixmapInfo->nativePixmap); //fall through -#endif CATCH_02: delete pPixmapInfo; //fall through +#endif CATCH_01: SysLog(NID_GRP, "_CreateNativePixmap failed!! pBitmap:%#x", (unsigned int)pBitmap); -- 2.7.4