[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:46:18 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 491f10b5b196eda260a2a33f69a3f03b16693f0c
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 15 07:38:52 2004 +0000

            Reviewed by Maciej.
    
            - fixed some things for GC that Patrick missed, or that happened after the branch
    
            * bindings/objc/WebScriptObject.mm:
            (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
            (-[WebScriptObject finalize]): Added.
    
            - added some missing nil checks
    
            * bindings/objc/objc_instance.mm:
            (ObjcInstance::ObjcInstance): Check for nil.
            (ObjcInstance::~ObjcInstance): Check for nil.
            (ObjcInstance::operator=): Check for nil.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6846 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index bdf392d..fa34aa3 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,22 @@
 2004-06-14  Darin Adler  <darin at apple.com>
 
+        Reviewed by Maciej.
+
+        - fixed some things for GC that Patrick missed, or that happened after the branch
+
+        * bindings/objc/WebScriptObject.mm:
+        (-[WebScriptObject dealloc]): Moved removeNativeReference call here from private object.
+        (-[WebScriptObject finalize]): Added.
+
+        - added some missing nil checks
+
+        * bindings/objc/objc_instance.mm:
+        (ObjcInstance::ObjcInstance): Check for nil.
+        (ObjcInstance::~ObjcInstance): Check for nil.
+        (ObjcInstance::operator=): Check for nil.
+
+2004-06-14  Darin Adler  <darin at apple.com>
+
         Reviewed by me, code changes by Patrick Beard.
 
         - fixed <rdar://problem/3671507>: (WebKit should adopt GC changes and compile with GC enabled)
diff --git a/JavaScriptCore/bindings/objc/WebScriptObject.mm b/JavaScriptCore/bindings/objc/WebScriptObject.mm
index 854da8c..6a38d6d 100644
--- a/JavaScriptCore/bindings/objc/WebScriptObject.mm
+++ b/JavaScriptCore/bindings/objc/WebScriptObject.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -22,6 +22,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+
 #import <JavaScriptCore/WebScriptObjectPrivate.h>
 
 #include <JavaScriptCore/internal.h>
@@ -35,6 +36,14 @@
 #include <runtime_object.h>
 #include <runtime_root.h>
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3
+
+ at interface NSObject (WebExtras)
+- (void)finalize;
+ at end
+
+#endif
+
 using namespace KJS;
 using namespace KJS::Bindings;
 
@@ -43,12 +52,7 @@ using namespace KJS::Bindings;
         NSLog (@"%s:%d:  JavaScript exception:  %s\n", __FILE__, __LINE__, exec->exception().toObject(exec).get(exec, messagePropertyName).toString(exec).ascii());
 
 @implementation WebScriptObjectPrivate
-- (void)dealloc
-{
-    removeNativeReference (imp);
-    
-    [super dealloc];
-}
+
 @end
 
 @implementation WebScriptObject
@@ -95,11 +99,19 @@ static void _didExecute(WebScriptObject *obj)
 
 - (void)dealloc
 {
+    removeNativeReference(_private->imp);
     [_private release];
         
     [super dealloc];
 }
 
+- (void)finalize
+{
+    removeNativeReference(_private->imp);
+        
+    [super finalize];
+}
+
 + (BOOL)throwException:(NSString *)exceptionMessage
 {
     NSLog (@"%s:%d:  not yet implemented", __PRETTY_FUNCTION__, __LINE__);
diff --git a/JavaScriptCore/bindings/objc/objc_instance.mm b/JavaScriptCore/bindings/objc/objc_instance.mm
index c3c9f6e..78a879a 100644
--- a/JavaScriptCore/bindings/objc/objc_instance.mm
+++ b/JavaScriptCore/bindings/objc/objc_instance.mm
@@ -41,7 +41,10 @@ using namespace KJS;
 
 ObjcInstance::ObjcInstance (ObjectStructPtr instance) 
 {
-    _instance = (id)CFRetain(instance);
+    _instance = (id)instance;
+    if (_instance) {
+        CFRetain(_instance);
+    }
     _class = 0;
     _pool = 0;
     _beginCount = 0;
@@ -51,12 +54,17 @@ ObjcInstance::~ObjcInstance ()
 {
     if ([_instance respondsToSelector:@selector(finalizeForWebScript)])
         [_instance finalizeForWebScript];
-    CFRelease(_instance);
+    if (_instance) {
+        CFRelease(_instance);
+    }
 }
 
 ObjcInstance::ObjcInstance (const ObjcInstance &other) : Instance() 
 {
-    _instance = (id) CFRetain(other._instance);
+    _instance = (id)other._instance;
+    if (_instance) {
+        CFRetain(_instance);
+    }
     _class = other._class;
     _pool = 0;
     _beginCount = 0;
@@ -65,8 +73,13 @@ ObjcInstance::ObjcInstance (const ObjcInstance &other) : Instance()
 ObjcInstance &ObjcInstance::operator=(const ObjcInstance &other)
 {
     ObjectStructPtr _oldInstance = _instance;
-    _instance = (id) CFRetain(other._instance);
-    CFRelease(_oldInstance);
+    _instance = other._instance;
+    if (_instance) {
+        CFRetain(_instance);
+    }
+    if (_oldInstance) {
+        CFRelease(_oldInstance);
+    }
     
     // Classes are kept around forever.
     _class = other._class;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list