[BlackBerry] Crash when destroying WebOverlay with active WebOverlayOverride

https://bugs.webkit.org/show_bug.cgi?id=87968

Patch by Arvid Nilsson <anilsson@rim.com> on 2012-05-31
Reviewed by Rob Buis.

The override object is using a compositing thread WebOverlayPrivate
object with no client because the layer doesn't delegate drawing to the
WebOverlayPrivate, it's only used to modify the override properties on
the underlying compositing thread layer.

Since the m_layerCompositingThreadClient is optional, we have to add
null checks.

* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2fff4785
......@@ -493,13 +493,15 @@ WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread()
WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread()
{
m_layerCompositingThreadClient->setClient(0, 0);
if (m_layerCompositingThreadClient)
m_layerCompositingThreadClient->setClient(0, 0);
}
void WebOverlayPrivateCompositingThread::setClient(WebOverlayClient* client)
{
WebOverlayPrivate::setClient(client);
m_layerCompositingThreadClient->setClient(q, client);
if (m_layerCompositingThreadClient)
m_layerCompositingThreadClient->setClient(q, client);
}
WebOverlayOverride* WebOverlayPrivateCompositingThread::override()
......@@ -614,6 +616,9 @@ void WebOverlayPrivateCompositingThread::removeFromParent()
void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char* data, const IntSize& imageSize)
{
if (!m_layerCompositingThreadClient)
return;
const SkBitmap& oldContents = m_layerCompositingThreadClient->contents();
if (!oldContents.isNull()) {
SkAutoLockPixels lock(oldContents);
......@@ -631,12 +636,18 @@ void WebOverlayPrivateCompositingThread::setContentsToImage(const unsigned char*
void WebOverlayPrivateCompositingThread::setContentsToColor(const Color& color)
{
if (!m_layerCompositingThreadClient)
return;
m_layerCompositingThreadClient->setContentsToColor(color);
m_layerCompositingThread->setNeedsTexture(true);
}
void WebOverlayPrivateCompositingThread::setDrawsContent(bool drawsContent)
{
if (!m_layerCompositingThreadClient)
return;
m_layerCompositingThreadClient->setDrawsContent(drawsContent);
m_layerCompositingThread->setNeedsTexture(true);
}
......@@ -648,7 +659,7 @@ void WebOverlayPrivateCompositingThread::clear()
void WebOverlayPrivateCompositingThread::invalidate()
{
if (!m_layerCompositingThreadClient->drawsContent())
if (!m_layerCompositingThreadClient || !m_layerCompositingThreadClient->drawsContent())
return;
m_layerCompositingThreadClient->invalidate();
......
2012-05-31 Arvid Nilsson <anilsson@rim.com>
[BlackBerry] Crash when destroying WebOverlay with active WebOverlayOverride
https://bugs.webkit.org/show_bug.cgi?id=87968
Reviewed by Rob Buis.
The override object is using a compositing thread WebOverlayPrivate
object with no client because the layer doesn't delegate drawing to the
WebOverlayPrivate, it's only used to modify the override properties on
the underlying compositing thread layer.
Since the m_layerCompositingThreadClient is optional, we have to add
null checks.
* Api/WebOverlay.cpp:
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::~WebOverlayPrivateCompositingThread):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setClient):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToColor):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setDrawsContent):
(BlackBerry::WebKit::WebOverlayPrivateCompositingThread::invalidate):
2012-05-31 Chris Guan <chris.guan@torchmobile.com.cn>
[Blackberry] WebKit's fullscreen mode needs to notify page client.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment