Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mysterious Java application crash



Florian Bruckner wrote:

The application is plain Swing, there is only a single snippet
of code that is using Cocoa API

So, from my point of view, this should not be able to cause the "garbage
collected java ref", as we work with hard references from a Java point
of view and keep references to the cocoa objects in code, but I may very
well be wrong, as I do not have experience with this API.

The Cocoa-Java classes are not intended for use in Swing programs -- this is all the com.apple.cocoa... packages. They are only safe to use in pure Cocoa-Java apps. Many of the methods are only safe to call from the AppKit thread -- which is inaccessible to a pure Swing/ Java app. The symptoms of misusing these methods are deadlocks and crashes. These packages are all deprecated by Apple, and will be removed in some future release (or so they tell us).


Rework the Cocoa-Java code to use JNI and Objective-C, and use NSObject performSelectorOnMainThread to get onto the AppKit thread. Since you're already running native code, you might as well use JAWT to get at the native Cocoa objects, and perform your operations there.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.