[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

tonikitoo at webkit.org tonikitoo at webkit.org
Thu Oct 29 20:45:25 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 0c1d1ffc212ebce3888dcc9ab910811f633c7a6f
Author: tonikitoo at webkit.org <tonikitoo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 15 17:14:13 2009 +0000

    [Qt] QGLauncher crashes while closing a window
    https://bugs.webkit.org/show_bug.cgi?id=30385
    
    Patch by Antonio Gomes <tonikitoo at webkit.org> on 2009-10-15
    Reviewed by Tor Arne.
    
    Set page's pageClient reference to '0' at QGWV deletion.
    
    * Api/qgraphicswebview.cpp:
    (QGraphicsWebView::~QGraphicsWebView):
    * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
    (WebPage::WebPage):
    (WebPage::aborting):
    (tst_QGraphicsWebView::crashOnViewlessWebPages):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49634 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index 7599d88..d94fdab 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -195,8 +195,10 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent)
 */
 QGraphicsWebView::~QGraphicsWebView()
 {
-    if (d->page)
+    if (d->page) {
         d->page->d->view = 0;
+        d->page->d->client = 0; // unset the page client
+    }
 
     if (d->page && d->page->parent() == this)
         delete d->page;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index a536c3f..a5c2430 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-15  Antonio Gomes  <tonikitoo at webkit.org>
+
+        Reviewed by Tor Arne.
+
+        [Qt] QGLauncher crashes while closing a window
+        https://bugs.webkit.org/show_bug.cgi?id=30385
+
+        Set page's pageClient reference to '0' at QGWV deletion.
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebView::~QGraphicsWebView):
+        * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
+        (WebPage::WebPage):
+        (WebPage::aborting):
+        (tst_QGraphicsWebView::crashOnViewlessWebPages):
+
 2009-10-13  Antonio Gomes  <tonikitoo at webkit.org>
 
         Reviewed by Simon Hausmann.
diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index 1a57286..4bdb7f5 100644
--- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -19,7 +19,33 @@
 
 #include <QtTest/QtTest>
 
+#include <QGraphicsView>
 #include <qgraphicswebview.h>
+#include <qwebpage.h>
+#include <qwebframe.h>
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ * Optionally the event loop
+ * can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ *         \p false on timeout
+ */
+static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
+{
+    QEventLoop loop;
+    QObject::connect(obj, signal, &loop, SLOT(quit()));
+    QTimer timer;
+    QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+    if (timeout > 0) {
+        QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+        timer.setSingleShot(true);
+        timer.start(timeout);
+    }
+    loop.exec();
+    return timeoutSpy.isEmpty();
+}
 
 class tst_QGraphicsWebView : public QObject
 {
@@ -27,6 +53,7 @@ class tst_QGraphicsWebView : public QObject
 
 private slots:
     void qgraphicswebview();
+    void crashOnViewlessWebPages();
 };
 
 void tst_QGraphicsWebView::qgraphicswebview()
@@ -53,6 +80,55 @@ void tst_QGraphicsWebView::qgraphicswebview()
     item.setContent(QByteArray());
 }
 
+class WebPage : public QWebPage
+{
+    Q_OBJECT
+
+public:
+    WebPage(QObject* parent = 0): QWebPage(parent)
+    {
+    }
+
+    QGraphicsWebView* webView;
+
+private slots:
+    // Force a webview deletion during the load.
+    // It should not cause WebPage to crash due to
+    // it accessing invalid pageClient pointer.
+    void aborting()
+    {
+        delete webView;
+    }
+};
+
+void tst_QGraphicsWebView::crashOnViewlessWebPages()
+{
+    QGraphicsScene scene;
+    QGraphicsView view(&scene);
+
+    QGraphicsWebView* webView = new QGraphicsWebView;
+    WebPage* page = new WebPage;
+    webView->setPage(page);
+    page->webView = webView;
+    connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting()));
+
+    scene.addItem(webView);
+
+    view.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    view.resize(600, 480);
+    webView->resize(view.geometry().size());
+    QTest::qWait(200);
+    view.show();
+
+    page->mainFrame()->setHtml(QString("data:text/html,"
+                                            "<frameset cols=\"25%,75%\">"
+                                                "<frame src=\"data:text/html,foo \">"
+                                                "<frame src=\"data:text/html,bar\">"
+                                            "</frameset>"));
+
+    QVERIFY(::waitForSignal(page, SIGNAL(loadFinished(bool))));
+}
+
 QTEST_MAIN(tst_QGraphicsWebView)
 
 #include "tst_qgraphicswebview.moc"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list