[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 18:29:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b7fb9b39ab90e4d11bafa0b550f8c7c466c01bc0
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Dec 12 03:42:44 2010 +0000

    2010-12-11  Yi Shen  <yi.4.shen at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Memory leaks for QWebPageClient
            https://bugs.webkit.org/show_bug.cgi?id=50267
    
            Use OwnPtr to solve this memory leak issue.
    
            * Api/qgraphicswebview.cpp:
            (QGraphicsWebViewPrivate::overlay):
            (QGraphicsWebViewPrivate::QWebViewPrivate::pageClient):
            (QGraphicsWebViewPrivate::syncLayers):
            (QGraphicsWebViewPrivate::updateResizesToContentsForPage):
            (QGraphicsWebViewPrivate::_q_scaleChanged):
            (QGraphicsWebViewPrivate::detachCurrentPage):
            * Api/qwebpage_p.h:
            * Api/qwebview.cpp:
            (QWebViewPrivate::detachCurrentPage):
            * WebCoreSupport/ChromeClientQt.cpp:
            (WebCore::ChromeClientQt::platformPageClient):
            * WebCoreSupport/EditorClientQt.cpp:
            (WebCore::EditorClientQt::setInputMethodState):
            * WebCoreSupport/FrameLoaderClientQt.cpp:
            (WebCore::FrameLoaderClientQt::createPlugin):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73867 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index c8438f3..9697c20 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -80,8 +80,13 @@ public:
     {
         if (!page || !page->d->client)
             return 0;
-        return static_cast<PageClientQGraphicsWidget*>(page->d->client)->overlay;
+        return pageClient()->overlay;
     }
+
+    PageClientQGraphicsWidget* pageClient() const
+    {
+        return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get());
+    } 
 };
 
 QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
@@ -92,7 +97,7 @@ QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
 void QGraphicsWebViewPrivate::syncLayers()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    static_cast<PageClientQGraphicsWidget*>(page->d->client)->syncLayers();
+    pageClient()->syncLayers();
 #endif
 }
 
@@ -128,7 +133,7 @@ void QGraphicsWebViewPrivate::_q_pageDestroyed()
 void QGraphicsWebViewPrivate::updateResizesToContentsForPage()
 {
     ASSERT(page);
-    static_cast<PageClientQGraphicsWidget*>(page->d->client)->viewResizesToContents = resizesToContents;
+    pageClient()->viewResizesToContents = resizesToContents;
     if (resizesToContents) {
         // resizes to contents mode requires preferred contents size to be set
         if (!page->preferredContentsSize().isValid())
@@ -156,7 +161,7 @@ void QGraphicsWebViewPrivate::_q_scaleChanged()
 #if ENABLE(TILED_BACKING_STORE)
     if (!page)
         return;
-    static_cast<PageClientQGraphicsWidget*>(page->d->client)->updateTiledBackingStoreScale();
+    pageClient()->updateTiledBackingStoreScale();
 #endif
 }
 
@@ -414,9 +419,6 @@ void QGraphicsWebViewPrivate::detachCurrentPage()
         return;
 
     page->d->view.clear();
-
-    // The client has always to be deleted.
-    delete page->d->client;
     page->d->client = 0;
 
     // if the page was created by us, we own it and need to
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 6fae04f..3e5160b 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -2008,7 +2008,7 @@ void QWebPage::setView(QWidget* view)
 
     if (d->client) {
         if (d->client->isQWidgetClient())
-            static_cast<PageClientQWidget*>(d->client)->view = view;
+            static_cast<PageClientQWidget*>(d->client.get())->view = view;
         return;
     }
 
diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index 624ff99..e062ba3 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -35,6 +35,7 @@
 #include "KURL.h"
 #include "PlatformString.h"
 
+#include <wtf/OwnPtr.h>
 #include <wtf/RefPtr.h>
 
 #include "ViewportArguments.h"
@@ -160,7 +161,7 @@ public:
 
     QWebPage *q;
     WebCore::Page *page;
-    QWebPageClient* client;
+    OwnPtr<QWebPageClient> client;
     QPointer<QWebFrame> mainFrame;
 
 #ifndef QT_NO_UNDOSTACK
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index 64b7a90..a04b5f2 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -353,9 +353,9 @@ void QWebViewPrivate::detachCurrentPage()
     // to destroy it.
 
     if (page->d->client && page->d->client->isQWidgetClient())
-        delete page->d->client;
+        page->d->client.clear();
 
-    page->d->client = 0;
+    page->d->client.release();
 
     // if the page was created by us, we own it and need to
     // destroy it as well.
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index b6c3902..fef2d75 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,29 @@
+2010-12-11  Yi Shen  <yi.4.shen at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Memory leaks for QWebPageClient
+        https://bugs.webkit.org/show_bug.cgi?id=50267
+
+        Use OwnPtr to solve this memory leak issue.
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebViewPrivate::overlay):
+        (QGraphicsWebViewPrivate::QWebViewPrivate::pageClient):
+        (QGraphicsWebViewPrivate::syncLayers):
+        (QGraphicsWebViewPrivate::updateResizesToContentsForPage):
+        (QGraphicsWebViewPrivate::_q_scaleChanged):
+        (QGraphicsWebViewPrivate::detachCurrentPage):
+        * Api/qwebpage_p.h:
+        * Api/qwebview.cpp:
+        (QWebViewPrivate::detachCurrentPage):
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::platformPageClient):
+        * WebCoreSupport/EditorClientQt.cpp:
+        (WebCore::EditorClientQt::setInputMethodState):
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::createPlugin):
+
 2010-12-11  Jan Erik Hanssen  <jhanssen at sencha.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 9d3673f..a26d6e2 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -74,6 +74,7 @@
 #include <qeventloop.h>
 #include <qtextdocument.h>
 #include <qtooltip.h>
+#include <wtf/OwnPtr.h>
 
 namespace WebCore {
 
@@ -453,7 +454,7 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const
 
 PlatformPageClient ChromeClientQt::platformPageClient() const
 {
-    return m_webPage->d->client;
+    return m_webPage->d->client.get();
 }
 
 void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
diff --git a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index 46eeeb0..0fb21c3 100644
--- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -53,6 +53,7 @@
 
 #include <QUndoStack>
 #include <stdio.h>
+#include <wtf/OwnPtr.h>
 
 #define methodDebug() qDebug("EditorClientQt: %s", __FUNCTION__);
 
@@ -574,7 +575,7 @@ void EditorClientQt::willSetInputMethodState()
 
 void EditorClientQt::setInputMethodState(bool active)
 {
-    QWebPageClient* webPageClient = m_page->d->client;
+    QWebPageClient* webPageClient = m_page->d->client.get();
     if (webPageClient) {
         Qt::InputMethodHints hints;
 
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 6496b4b..479a879 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -86,6 +86,7 @@
 #include <QNetworkReply>
 #include <QStringList>
 #include "qwebhistory_p.h"
+#include <wtf/OwnPtr.h>
 
 static QMap<unsigned long, QString> dumpAssignedUrls;
 
@@ -1536,7 +1537,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
         Vector<String> values = paramValues;
 #if !OS(SYMBIAN)
         if (mimeType == "application/x-shockwave-flash") {
-            QWebPageClient* client = m_webFrame->page()->d->client;
+            QWebPageClient* client = m_webFrame->page()->d->client.get();
             const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent());
 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
             size_t wmodeIndex = params.find("wmode");

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list