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

oliver at apple.com oliver at apple.com
Wed Apr 7 23:10:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 35f506eb326b02058dd07f1bc862c5f72cb6073e
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 28 01:26:14 2009 +0000

    Crash occurs after launching Newsfire 1.6 for the first time
    https://bugs.webkit.org/show_bug.cgi?id=30807
    
    Reviewed by Darin Adler.
    
    We allocate an autorelease pool but then store it off the stack. In a
    GC environment this led to it being collected, and thus caused badness
    to ensue.  To work around this we simply avoid using a pool at all in
    a GC environment as it would be a no-op anyway.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e6b540a..6a7c709 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-27  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Crash occurs after launching Newsfire 1.6 for the first time
+        https://bugs.webkit.org/show_bug.cgi?id=30807
+
+        We allocate an autorelease pool but then store it off the stack. In a
+        GC environment this led to it being collected, and thus caused badness
+        to ensue.  To work around this we simply avoid using a pool at all in
+        a GC environment as it would be a no-op anyway.
+
+        * bridge/objc/objc_instance.mm:
+        (allocateAutoReleasePool):
+        (ObjcInstance::virtualBegin):
+
 2009-10-27  Steve Block  <steveblock at google.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm
index f7550e4..b4b308b 100644
--- a/WebCore/bridge/objc/objc_instance.mm
+++ b/WebCore/bridge/objc/objc_instance.mm
@@ -28,9 +28,10 @@
 
 #import "FoundationExtras.h"
 #import "WebScriptObject.h"
-#include <runtime/Error.h>
-#include <runtime/JSLock.h>
-#include <wtf/Assertions.h>
+#import <objc/objc-auto.h>
+#import <runtime/Error.h>
+#import <runtime/JSLock.h>
+#import <wtf/Assertions.h>
 
 #ifdef NDEBUG
 #define OBJC_LOG(formatAndArgs...) ((void)0)
@@ -123,10 +124,22 @@ ObjcInstance::~ObjcInstance()
     [pool drain];
 }
 
+static NSAutoreleasePool* allocateAutoReleasePool()
+{
+#if defined(OBJC_API_VERSION) && OBJC_API_VERSION >= 2
+    // If GC is enabled an autorelease pool is unnecessary, and the
+    // pool cannot be protected from GC so may be collected leading
+    // to a crash when we try to GC.
+    if (objc_collectingEnabled())
+        return nil;
+#endif
+    return [[NSAutoreleasePool alloc] init];
+}
+
 void ObjcInstance::virtualBegin()
 {
     if (!_pool)
-        _pool = [[NSAutoreleasePool alloc] init];
+        _pool = allocateAutoReleasePool();
     _beginCount++;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list