[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Wed Apr 7 23:36:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6f23319a32286ded759b72809ece22a0f1f4e274
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 13 00:44:23 2009 +0000

    2009-11-12  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Darin Adler.
    
            Fix crash when removing compositing layers when GC is enabled
            https://bugs.webkit.org/show_bug.cgi?id=31429
    
            Workaround <rdar://problem/7390716> by special-casing the removal
            of all sublayers when GC is enabled.
    
            * platform/graphics/mac/GraphicsLayerCA.mm:
            (WebCore::safeSetSublayers):
            (WebCore::GraphicsLayerCA::updateSublayerList):
            (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3f69169..54aa7f7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-11-12  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix crash when removing compositing layers when GC is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=31429
+
+        Workaround <rdar://problem/7390716> by special-casing the removal
+        of all sublayers when GC is enabled.
+
+        * platform/graphics/mac/GraphicsLayerCA.mm:
+        (WebCore::safeSetSublayers):
+        (WebCore::GraphicsLayerCA::updateSublayerList):
+        (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
+
 2009-11-12  Jens Alfke  <snej at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index b351956..abf11da 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -47,6 +47,7 @@
 #import "WebLayer.h"
 #import "WebTiledLayer.h"
 #import <limits.h>
+#import <objc/objc-auto.h>
 #import <wtf/CurrentTime.h>
 #import <wtf/UnusedParam.h>
 #import <wtf/RetainPtr.h>
@@ -298,6 +299,18 @@ static void clearLayerBackgroundColor(PlatformLayer* layer)
     [layer setBackgroundColor:0];
 }
 
+static void safeSetSublayers(CALayer* layer, NSArray* sublayers)
+{
+    // Workaround for <rdar://problem/7390716>: -[CALayer setSublayers:] crashes if sublayers is an empty array, or nil, under GC.
+    if (objc_collectingEnabled() && ![sublayers count]) {
+        while ([[layer sublayers] count])
+            [[[layer sublayers] objectAtIndex:0] removeFromSuperlayer];
+        return;
+    }
+    
+    [layer setSublayers:sublayers];
+}
+
 static bool caValueFunctionSupported()
 {
     static bool sHaveValueFunction = [CAPropertyAnimation instancesRespondToSelector:@selector(setValueFunction:)];
@@ -882,17 +895,16 @@ void GraphicsLayerCA::updateSublayerList()
     [newSublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];
 
     if (m_transformLayer) {
-        [m_transformLayer.get() setSublayers:newSublayers];
+        safeSetSublayers(m_transformLayer.get(), newSublayers);
 
         if (m_contentsLayer) {
             // If we have a transform layer, then the contents layer is parented in the 
             // primary layer (which is itself a child of the transform layer).
-            [m_layer.get() setSublayers:nil];
+            safeSetSublayers(m_layer.get(), nil);
             [m_layer.get() addSublayer:m_contentsLayer.get()];
         }
-    } else {
-        [m_layer.get() setSublayers:newSublayers];
-    }
+    } else
+        safeSetSublayers(m_layer.get(), newSublayers);
 
     [newSublayers release];
 }
@@ -1757,7 +1769,7 @@ void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)
     }
     
     [m_layer.get() setLayerOwner:this];
-    [m_layer.get() setSublayers:[oldLayer.get() sublayers]];
+    safeSetSublayers(m_layer.get(), [oldLayer.get() sublayers]);
     
     [[oldLayer.get() superlayer] replaceSublayer:oldLayer.get() with:m_layer.get()];
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list