Title: [128315] trunk/Source
Revision
128315
Author
commit-qu...@webkit.org
Date
2012-09-12 08:36:45 -0700 (Wed, 12 Sep 2012)

Log Message

[Qt] Segmentation fault when closing QtTestBrowser
https://bugs.webkit.org/show_bug.cgi?id=95003

Patch by Roland Takacs <rtak...@inf.u-szeged.hu> on 2012-09-12
Reviewed by Simon Hausmann.

Source/WebCore:

Defined a new QObject* variable.
If WebKit1 is used, it points to the QGLWidget that was
created in 'createPlatformGraphicsContext3DFromWidget'.
If WebKit2 is used, it points to the QWindow that was
created in GraphicsContext3DPrivate's constructor.
It is neccessary for deallocating them.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
(GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
* platform/qt/QWebPageClient.h:
(QWebPageClient):

Source/WebKit/qt:

Defined a new QObject* variable that points to the QGLWidget that was created
in 'createPlatformGraphicsContext3DFromWidget'.
It is neccessary for deallocating it.

* WebCoreSupport/PageClientQt.cpp:
(createPlatformGraphicsContext3DFromWidget):
(WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
(WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
* WebCoreSupport/PageClientQt.h:
(PageClientQWidget):
(PageClientQGraphicsWidget):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128314 => 128315)


--- trunk/Source/WebCore/ChangeLog	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebCore/ChangeLog	2012-09-12 15:36:45 UTC (rev 128315)
@@ -1,3 +1,24 @@
+2012-09-12  Roland Takacs  <rtak...@inf.u-szeged.hu>
+
+        [Qt] Segmentation fault when closing QtTestBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=95003
+
+        Reviewed by Simon Hausmann.
+
+        Defined a new QObject* variable.
+        If WebKit1 is used, it points to the QGLWidget that was 
+        created in 'createPlatformGraphicsContext3DFromWidget'.
+        If WebKit2 is used, it points to the QWindow that was 
+        created in GraphicsContext3DPrivate's constructor.
+        It is neccessary for deallocating them.
+
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (GraphicsContext3DPrivate):
+        (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+        (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+        * platform/qt/QWebPageClient.h:
+        (QWebPageClient):
+
 2012-09-12  Ryuan Choi  <ryuan.c...@samsung.com>
 
         [EFL] Fix build break when netscape-plugin-api is enebled after r126971

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (128314 => 128315)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-09-12 15:36:45 UTC (rev 128315)
@@ -84,6 +84,7 @@
     HostWindow* m_hostWindow;
     PlatformGraphicsSurface3D m_surface;
     PlatformGraphicsContext3D m_platformContext;
+    QObject* m_surfaceOwner;
 #if USE(GRAPHICS_SURFACE)
     GraphicsSurface::Flags m_surfaceFlags;
     RefPtr<GraphicsSurface> m_graphicsSurface;
@@ -111,11 +112,12 @@
     , m_hostWindow(hostWindow)
     , m_surface(0)
     , m_platformContext(0)
+    , m_surfaceOwner(0)
 {
     if (m_hostWindow && m_hostWindow->platformPageClient()) {
         // This is the WebKit1 code path.
         QWebPageClient* webPageClient = m_hostWindow->platformPageClient();
-        webPageClient->createPlatformGraphicsContext3D(&m_platformContext, &m_surface);
+        webPageClient->createPlatformGraphicsContext3D(&m_platformContext, &m_surface, &m_surfaceOwner);
         if (!m_surface)
             return;
 
@@ -137,6 +139,7 @@
     window->setGeometry(-10, -10, 1, 1);
     window->create();
     m_surface = window;
+    m_surfaceOwner = window;
 
     m_platformContext = new QOpenGLContext(window);
     if (!m_platformContext->create())
@@ -208,12 +211,8 @@
 
 GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
 {
-    if (m_hostWindow) {
-        delete m_surface;
-        m_surface = 0;
-        // Platform context is assumed to be owned by surface.
-        m_platformContext = 0;
-    }
+    delete m_surfaceOwner;
+    m_surfaceOwner = 0;
 }
 
 static inline quint32 swapBgrToRgb(quint32 pixel)

Modified: trunk/Source/WebCore/platform/qt/QWebPageClient.h (128314 => 128315)


--- trunk/Source/WebCore/platform/qt/QWebPageClient.h	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebCore/platform/qt/QWebPageClient.h	2012-09-12 15:36:45 UTC (rev 128315)
@@ -108,7 +108,8 @@
 
 #if USE(3D_GRAPHICS)
     virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
-                                                 PlatformGraphicsSurface3D*) = 0;
+                                                 PlatformGraphicsSurface3D*,
+                                                 QObject** = 0) = 0;
 #endif
     virtual QWindow* ownerWindow() const;
 

Modified: trunk/Source/WebKit/qt/ChangeLog (128314 => 128315)


--- trunk/Source/WebKit/qt/ChangeLog	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-09-12 15:36:45 UTC (rev 128315)
@@ -1,3 +1,22 @@
+2012-09-12  Roland Takacs  <rtak...@inf.u-szeged.hu>
+
+        [Qt] Segmentation fault when closing QtTestBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=95003
+
+        Reviewed by Simon Hausmann.
+
+        Defined a new QObject* variable that points to the QGLWidget that was created
+        in 'createPlatformGraphicsContext3DFromWidget'.
+        It is neccessary for deallocating it.
+
+        * WebCoreSupport/PageClientQt.cpp:
+        (createPlatformGraphicsContext3DFromWidget):
+        (WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
+        (WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
+        * WebCoreSupport/PageClientQt.h:
+        (PageClientQWidget):
+        (PageClientQGraphicsWidget):
+
 2012-09-12  Andras Becsi  <andras.be...@nokia.com>
 
         [Qt] Add module identifier directive to the qmldir files

Modified: trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp (128314 => 128315)


--- trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp	2012-09-12 15:36:45 UTC (rev 128315)
@@ -36,11 +36,13 @@
 #include <QWindow>
 
 static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context,
-                                                      PlatformGraphicsSurface3D* surface)
+                                                      PlatformGraphicsSurface3D* surface, QObject** surfaceOwner)
 {
 #ifdef QT_OPENGL_LIB
     *context = 0;
     *surface = 0;
+    if (surfaceOwner)
+        *surfaceOwner = 0;
     QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
     if (!scrollArea)
         return;
@@ -52,6 +54,8 @@
     if (glWidget->isValid()) {
         // Geometry can be set to zero because m_glWidget is used only for its QGLContext.
         glWidget->setGeometry(0, 0, 0, 0);
+        if (surfaceOwner)
+            *surfaceOwner = glWidget;
         *surface = glWidget->windowHandle();
         *context = glWidget->context()->contextHandle();
     } else {
@@ -235,9 +239,10 @@
 
 #if USE(3D_GRAPHICS)
 void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
-                                                        PlatformGraphicsSurface3D* surface)
+                                                        PlatformGraphicsSurface3D* surface,
+                                                        QObject** surfaceOwner)
 {
-    createPlatformGraphicsContext3DFromWidget(view, context, surface);
+    createPlatformGraphicsContext3DFromWidget(view, context, surface, surfaceOwner);
 }
 #endif
 
@@ -424,9 +429,10 @@
 
 #if USE(3D_GRAPHICS)
 void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
-                                                                PlatformGraphicsSurface3D* surface)
+                                                                PlatformGraphicsSurface3D* surface,
+                                                                QObject** surfaceOwner)
 {
-    createPlatformGraphicsContext3DFromWidget(ownerWidget(), context, surface);
+    createPlatformGraphicsContext3DFromWidget(ownerWidget(), context, surface, surfaceOwner);
 }
 #endif
 

Modified: trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h (128314 => 128315)


--- trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h	2012-09-12 15:34:37 UTC (rev 128314)
+++ trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.h	2012-09-12 15:36:45 UTC (rev 128315)
@@ -101,7 +101,8 @@
 
 #if USE(3D_GRAPHICS)
     virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
-                                                 PlatformGraphicsSurface3D*);
+                                                 PlatformGraphicsSurface3D*,
+                                                 QObject**);
 #endif
 
     QWidget* view;
@@ -209,7 +210,8 @@
 
 #if USE(3D_GRAPHICS)
     virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
-                                                 PlatformGraphicsSurface3D*);
+                                                 PlatformGraphicsSurface3D*,
+                                                 QObject**);
 #endif
 
 #if USE(TILED_BACKING_STORE)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to