Fix webgl crash issue.
authorYongGeol Jung <yg48.jung@samsung.com>
Tue, 9 Jul 2013 07:47:48 +0000 (16:47 +0900)
committerYongGeol Jung <yg48.jung@samsung.com>
Tue, 9 Jul 2013 07:47:48 +0000 (16:47 +0900)
[Title] Fix webgl crash issue.
[Issue#] DCM-2169
[Problem] Webgl page does not launch in the emulator.
[Cause] Member variable was not cleared after calling XDestroyImage.
[Solution] Clear member variable.

Change-Id: Id79303845ebbf708f6a60ff058ca0e3f6c30ac96

Source/WebCore/platform/graphics/surfaces/efl/GraphicsSurfaceEfl.cpp

index 3bd6424..b155441 100755 (executable)
@@ -92,6 +92,7 @@ struct GraphicsSurfacePrivate {
         m_shmInfo.shmid = shmget(IPC_PRIVATE, m_xImage->bytes_per_line * m_xImage->height, IPC_CREAT | 0666);
         if (m_shmInfo.shmid == -1) {
             XDestroyImage(m_xImage);
+            m_xImage = NULL;
             fprintf(stderr, "Error getting the shared image info\n");
             return;
         }
@@ -103,6 +104,7 @@ struct GraphicsSurfacePrivate {
             shmdt(m_shmInfo.shmaddr);
             shmctl(m_shmInfo.shmid, IPC_RMID, 0);
             XDestroyImage(m_xImage);
+            m_xImage = NULL;
             return;
         }
 
@@ -116,6 +118,9 @@ struct GraphicsSurfacePrivate {
             return;
         }
 
+        if (!m_xImage)
+            return;
+
         XGrabServer(g_display);
         if (!XShmGetImage(g_display, (Drawable)m_platformSurfaceID, m_xImage, 0, 0, 0xffffffff))
             fprintf(stderr, "Error Getting ShmGetImage\n");
@@ -128,7 +133,7 @@ struct GraphicsSurfacePrivate {
             std::swap(m_xImage->data[i], m_xImage->data[i + 2]);
     }
 
-    void* xImageData() { return m_xImage->data; }
+    void* xImageData() { return m_xImage ? m_xImage->data : 0; }
     void swapBuffers() { }
     IntSize size() const { return m_size; }