jdk/src/macosx/native/sun/awt/LWCToolkit.m
changeset 23651 e41298d0da2f
parent 23328 4c53a6ebc779
child 23681 2044c9d2b681
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Fri Mar 14 14:23:33 2014 +0400
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Fri Mar 14 16:01:04 2014 +0400
@@ -291,17 +291,15 @@
 {
 AWT_ASSERT_APPKIT_THREAD;
 
-    AWTRunLoopObject *o = nil;
+    jlong result;
 
+JNF_COCOA_ENTER(env);
     // We double retain because this object is owned by both main thread and "other" thread
     // We release in both doAWTRunLoop and stopAWTRunLoop
-    o = [[AWTRunLoopObject alloc] init];
-    if (o) {
-        CFRetain(o); // GC
-        CFRetain(o); // GC
-        [o release];
-    }
-    return ptr_to_jlong(o);
+    result = ptr_to_jlong([[[AWTRunLoopObject alloc] init] retain]);
+JNF_COCOA_EXIT(env);
+
+    return result;
 }
 
 /*
@@ -336,10 +334,7 @@
 
         }
     }
-
-   
-    CFRelease(mediatorObject);
-
+    [mediatorObject release];
 JNF_COCOA_EXIT(env);
 }
 
@@ -357,7 +352,7 @@
 
     [ThreadUtilities performOnMainThread:@selector(endRunLoop) on:mediatorObject withObject:nil waitUntilDone:NO];
 
-    CFRelease(mediatorObject);
+    [mediatorObject release];
 
 JNF_COCOA_EXIT(env);
 }