2011-03-16 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 23:48:44 +0000 (23:48 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 23:48:44 +0000 (23:48 +0000)
        Reviewed by Beth Dakin.

        RenderFullScreen::createFullScreenStyle() leaks
        https://bugs.webkit.org/show_bug.cgi?id=53384

        Two problems: a) not calling release() on the style returned in setFullScreenRenderer
        causes an unnecessary ref/deref, and b) the fullscreen renderer needs to be destroyed,
        not just detached, when it is no longer needed.

        * dom/Document.cpp:
        (WebCore::Document::setFullScreenRenderer): Destroy the current renderer when a new one is set.
        * rendering/RenderFullScreen.cpp:
        (RenderFullScreen::createFullScreenStyle): release() the return value.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/rendering/RenderFullScreen.cpp

index 1022305..cd1a377 100644 (file)
@@ -1,3 +1,19 @@
+2011-03-16  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        RenderFullScreen::createFullScreenStyle() leaks
+        https://bugs.webkit.org/show_bug.cgi?id=53384
+
+        Two problems: a) not calling release() on the style returned in setFullScreenRenderer
+        causes an unnecessary ref/deref, and b) the fullscreen renderer needs to be destroyed,
+        not just detached, when it is no longer needed.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFullScreenRenderer): Destroy the current renderer when a new one is set.
+        * rendering/RenderFullScreen.cpp:
+        (RenderFullScreen::createFullScreenStyle): release() the return value.
+
 2011-03-16  Mike Reed  <reed@google.com>
 
         Reviewed by James Robinson.
index c7c90de..ef2b680 100644 (file)
@@ -4963,6 +4963,11 @@ void Document::webkitDidExitFullScreenForElement(Element*)
     
 void Document::setFullScreenRenderer(RenderFullScreen* renderer)
 {
+    if (renderer == m_fullScreenRenderer)
+        return;
+
+    if (m_fullScreenRenderer)
+        m_fullScreenRenderer->destroy();
     m_fullScreenRenderer = renderer;
     
     // This notification can come in after the page has been destroyed.
index cc53a6e..a685064 100644 (file)
@@ -64,7 +64,7 @@ PassRefPtr<RenderStyle> RenderFullScreen::createFullScreenStyle()
     
     fullscreenStyle->setBackgroundColor(Color::black);
     
-    return fullscreenStyle;
+    return fullscreenStyle.release();
 }
 
 #endif