equal
deleted
inserted
replaced
226 styleMask:styleMask |
226 styleMask:styleMask |
227 contentView:view]; |
227 contentView:view]; |
228 } |
228 } |
229 |
229 |
230 if (self.nsWindow == nil) return nil; // no hope either |
230 if (self.nsWindow == nil) return nil; // no hope either |
|
231 [self.nsWindow release]; // the property retains the object already |
231 |
232 |
232 self.isEnabled = YES; |
233 self.isEnabled = YES; |
233 self.javaPlatformWindow = platformWindow; |
234 self.javaPlatformWindow = platformWindow; |
234 self.styleBits = bits; |
235 self.styleBits = bits; |
235 [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; |
236 [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)]; |
675 |
676 |
676 window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow |
677 window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow |
677 styleBits:styleBits |
678 styleBits:styleBits |
678 frameRect:frameRect |
679 frameRect:frameRect |
679 contentView:contentView]; |
680 contentView:contentView]; |
680 |
681 // the window is released is CPlatformWindow.nativeDispose() |
681 if (window) CFRetain(window); |
682 |
682 [window release]; // GC |
683 if (window) CFRetain(window.nsWindow); |
683 }]; |
684 }]; |
684 |
685 |
685 JNF_COCOA_EXIT(env); |
686 JNF_COCOA_EXIT(env); |
686 |
687 |
687 return ptr_to_jlong(window ? window.nsWindow : nil); |
688 return ptr_to_jlong(window ? window.nsWindow : nil); |
1158 }]; |
1159 }]; |
1159 |
1160 |
1160 JNF_COCOA_EXIT(env); |
1161 JNF_COCOA_EXIT(env); |
1161 } |
1162 } |
1162 |
1163 |
|
1164 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeDispose |
|
1165 (JNIEnv *env, jclass clazz, jlong windowPtr) |
|
1166 { |
|
1167 JNF_COCOA_ENTER(env); |
|
1168 |
|
1169 NSWindow *nsWindow = OBJC(windowPtr); |
|
1170 [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){ |
|
1171 AWTWindow *window = (AWTWindow*)[nsWindow delegate]; |
|
1172 |
|
1173 // AWTWindow holds a reference to the NSWindow in its nsWindow |
|
1174 // property. Unsetting the delegate allows it to be deallocated |
|
1175 // which releases the reference. This, in turn, allows the window |
|
1176 // itself be deallocated. |
|
1177 [nsWindow setDelegate: nil]; |
|
1178 |
|
1179 [window release]; |
|
1180 }]; |
|
1181 |
|
1182 JNF_COCOA_EXIT(env); |
|
1183 } |
|
1184 |