Re: NSOutlineView from Java or Bust
Re: NSOutlineView from Java or Bust
- Subject: Re: NSOutlineView from Java or Bust
- From: Chuck Pisula <email@hidden>
- Date: Mon, 14 May 2001 08:47:11 -0700
One thing to keep in mind when using NSOulineView is that it does not
retain the items it is displaying. In java this means you will need to
keep a reference explicitly to the items so that they are not
automatically garbage collected. I would guess this is the problem you
are hitting.
-c
On Sunday, May 13, 2001, at 08:24 PM, Dave Horlick wrote:
>
I am encountering a weird and frustrating problem while trying to use
>
an NSOutlineView from Java.
>
>
I wrote two distinct versions of a simple OutlineView demo, one in
>
Objective-C and one in Java. Both demos have hooks into interface
>
builder. These hooks set the OutlineView's data source delegate when a
>
button is pressed.
>
>
The demos are each written to display the following:
>
>
+ Heading
>
|---Subheading
>
|---Subheading
>
|---Subheading
>
>
and so on, with several subheadings. My Objective-C version of this
>
demo works, no problem.
>
>
My Java version, on the other hand, works only occasionally.
>
>
The Heading item displays after I click my load button. It is when I
>
click on its disclosure triangle that my demo crashes... sometimes. I
>
am usually okay if I set it to display only a small number of
>
Subheadings. But if I ask for many, it will choke on a
>
NullPointerException. Sometimes this will occur on the 21st subheading,
>
sometimes on the 30th, sometimes on the 34th. There seems to be no
>
rhyme or reason to it.
>
>
The console will not reveal where this NullPointerException is actually
>
being thrown. The Stack Trace is empty. All I get is the cryptic
>
information that "TestOutlineView.app has exited due to signal 10
>
(SIGBUS)."
>
>
The Java version of my demo has three source files: a simple controller
>
class, and two empty public classes called Heading and Subheading. I
>
instantiate a data source anonymously from the NSOutlineView.DataSource
>
interface/protocol. (I have also tried implementing this as a separate,
>
named class too and it doesn't help.)
>
>
I would appreciate any insights that anyone can provide. I have
>
included the source for my controller class below.