From 2ffb3229b771fa286749b84434f80ffa5fc4b73e Mon Sep 17 00:00:00 2001 From: Kondapally Kalyan Date: Tue, 18 Jun 2013 01:26:44 +0300 Subject: [PATCH] Fix crash with WebGL demos. While creating a new pixmap context, we obtain raw pointer after calling release. The release call already passes the ownership and resets the temporary pointer to null. The patch changes so that the raw pointer is obtained before passing the ownership. Also removes an un-necessary makecurrent call. The patch also adds a null ptr check in GraphicsContext3DOffscreen. Change-Id: I14eaef21356c479885f575ea086c8ae7ced637e0 --- .../platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp | 7 ++++++- .../platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp index 4fbdd35..80af7d0 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp +++ b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp @@ -167,6 +167,9 @@ bool GraphicsContext3DOffscreen::initialize(HostWindow* hostWindow) #if ENABLE(TIZEN_WEBKIT2) #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE) RefPtr newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(1, 1), m_attributes.alpha, m_attributes.depth, m_attributes.stencil)); + if (!newSurface->m_platformSurface) + return false; + m_platformSurfaces.add(newSurface->m_platformSurface->id(), newSurface); m_currentPlatformSurface = newSurface->m_platformSurface.get(); #else @@ -460,8 +463,10 @@ SharedPlatformSurfaceTizen* GraphicsContext3DOffscreen::getFreePlatformSurface() if (!newPlatformSurface) { if (m_platformSurfaces.size() < m_maxPlatformSurface) { RefPtr newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(m_width, m_height), m_attributes.alpha, m_attributes.depth, m_attributes.stencil)); - m_platformSurfaces.add(newSurface->m_platformSurface->id(), newSurface); newPlatformSurface = newSurface->m_platformSurface.get(); + + if (newPlatformSurface) + m_platformSurfaces.add(newSurface->m_platformSurface->id(), newSurface); } } diff --git a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp index 890fe68..e5fd601 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp +++ b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp @@ -93,17 +93,15 @@ GLPlatformContext* PixmapContextPool::getContext(GLPlatformSurface* surface) int contextId = ((isLockable) | (hasAlpha << 1) | (hasDepth << 2) | (hasStencil << 3)); GLPlatformContext* pixmapContext = m_pixmapContexts.get(contextId); - if (pixmapContext && !pixmapContext->makeCurrent(surface)) - pixmapContext = 0; - if (!pixmapContext) { - OwnPtr context = GLPlatformContext::createContext(GraphicsContext3D::RenderOffscreen); + OwnPtr context = GLPlatformContext::createContext(GraphicsContext3D::RenderOffscreen); if (context && context->initialize(surface)) { - m_pixmapContexts.add(contextId, context.release()); pixmapContext = context.get(); + m_pixmapContexts.add(contextId, context.release()); } else - return 0; + pixmapContext = 0; } + return pixmapContext; } -- 2.7.4