diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-05-08 15:54:18 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-09 11:48:35 +0200 |
commit | 11ab493ffbb20c6632e04ad2cf20b5a17ed3f010 (patch) | |
tree | 71651861c33d8814b625a7b384a195d2c73b0fdb | |
parent | a93d5f3f0eaca242e3541881b735862dc994286a (diff) | |
download | qtwebkit-11ab493ffbb20c6632e04ad2cf20b5a17ed3f010.tar.gz |
Fix leak of QSensors on QWebPage creation
The WebCore page supplements are not deleted when the page is, so we
need to track them in QWebPageAdapter and delete them there.
Task-number: QTBUG-38857
Change-Id: Ib3e41074de3bebf00f017523d28efc1c923250f3
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 19 | ||||
-rw-r--r-- | Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h | 4 |
2 files changed, 16 insertions, 7 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index fb4a91232..13fbe88d3 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -215,6 +215,8 @@ QWebPageAdapter::QWebPageAdapter() , m_totalBytes(0) , m_bytesReceived() , networkManager(0) + , m_deviceOrientationClient(0) + , m_deviceMotionClient(0) { WebCore::initializeWebCoreQt(); } @@ -247,18 +249,17 @@ void QWebPageAdapter::initializeWebCorePage() #if ENABLE(DEVICE_ORIENTATION) if (useMock) { - DeviceOrientationClientMock* mockOrientationClient = new DeviceOrientationClientMock; - WebCore::provideDeviceOrientationTo(page, mockOrientationClient); - - DeviceMotionClientMock* mockMotionClient= new DeviceMotionClientMock; - WebCore::provideDeviceMotionTo(page, mockMotionClient); + m_deviceOrientationClient = new DeviceOrientationClientMock; + m_deviceMotionClient = new DeviceMotionClientMock; } #if HAVE(QTSENSORS) else { - WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt); - WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt); + m_deviceOrientationClient = new DeviceOrientationClientQt; + m_deviceMotionClient = new DeviceMotionClientQt; } #endif + WebCore::provideDeviceOrientationTo(page, m_deviceOrientationClient); + WebCore::provideDeviceMotionTo(page, m_deviceMotionClient); #endif // By default each page is put into their own unique page group, which affects popup windows @@ -289,6 +290,10 @@ QWebPageAdapter::~QWebPageAdapter() #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif +#if ENABLE(DEVICE_ORIENTATION) + delete m_deviceMotionClient; + delete m_deviceOrientationClient; +#endif } void QWebPageAdapter::deletePage() diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h index 3629e906d..5e6efa697 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h @@ -47,6 +47,8 @@ QT_END_NAMESPACE namespace WebCore { class ChromeClientQt; +class DeviceOrientationClient; +class DeviceMotionClient; class GeolocationClientQt; class Page; class UndoStep; @@ -374,6 +376,8 @@ public: private: QNetworkAccessManager *networkManager; + WebCore::DeviceOrientationClient* m_deviceOrientationClient; + WebCore::DeviceMotionClient* m_deviceMotionClient; public: static bool drtRun; |