Re: Java, NSApplication, & NSWindow
Re: Java, NSApplication, & NSWindow
- Subject: Re: Java, NSApplication, & NSWindow
- From: Sam Goldman <email@hidden>
- Date: Mon, 26 Nov 2001 21:49:15 -0800
I am not sure about Cocoa with Java, but with ObjC, a segfault occurs when
you are trying to access something that isn't in memory (e.g. It was
autoreleased). If this is the case with Java, which I assume it is (maybe
garbage collectors picked it up...), then the problem could be anywhere and
unless that is the entirety of your code (or it really is in there), it
could be difficult to find. Look through your code and maybe write up a
diagram describing when your objects are released. That always helps me.
Hell, I could be completely mistaken, but I gave it a shot.
- Sam
On 11/26/01 9:21 PM, "Maurice Parker" <email@hidden>
wrote:
>
Hey,
>
>
I have a very simple Java program that is doing something that has perplexed
>
me for about a day and a half. The program creates a NSApplication and then
>
creates and opens a NSWindow. Everything pretty much works as expected, but
>
when I close the window, I get a segfault. What I expected to happen, was
>
to have the application continue to execute, minus the window.
>
>
Am I doing something boneheaded or is this a bug? Here is an example of the
>
behavior:
>
>
import com.apple.cocoa.application.*;
>
import com.apple.cocoa.foundation.*;
>
>
public class Test {
>
>
public static void main (String [] args) {
>
>
NSApplication nsapp = NSApplication.sharedApplication();
>
NSRect rect = new NSRect(100, 100, 100, 100);
>
int style = NSWindow.ClosableWindowMask | NSWindow.TitledWindowMask
>
| NSWindow.ResizableWindowMask|
>
NSWindow.MiniaturizableWindowMask;;
>
NSWindow window = new NSWindow(rect, style, NSWindow.Buffered,
>
false);
>
window.makeKeyAndOrderFront(window);
>
nsapp.run();
>
>
}
>
>
}
>
>
>
Any help is appreciated.
>
>
-Maurice
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev