> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:
[hidden email]] De la
> part de Rasband Wayne
> Envoyé : samedi 1 juillet 2006 03:18
> À :
[hidden email]
> Objet : Re: ByteProcessor class pixel[] fieldl become NULL
> when closing associated ImagePlus windows
>
> > My plugin write some annotations into a ByteProcessor
> displayed in an
> > ImagePlus (I use putPixel,drawString methods, etc.).
> > My annotated ByteProcessor instance is stored as a field in a
> > dedicated class so I can display it again and again in a
> new ImagePlus
> > window if user unfortunatly close current image (I don't
> know how to
> > prevent user closing ImagePlus windows ;).
> >
> > The null pointer exception occurs when user close the ImagePlus
> > windows and continue working anyway. My ByteProcessor
> instance, is not
> > null but sudently Null pointer error occurs in
> > ij.process.ByteProcessor.putPixel method or any other ByteProcessor
> > method using Pixel[] array field. A quick debug showed that
> this array
> > is null since ImagePlus is closed although my ByteProcessor
> is still
> > not null.
> >
> > Is-it a normal behaviour ? How can I troubleshoot my pb ?
>
> ImageJ sets the pixel arrays to null when the window is
> closed to encourage garbage collection. You can prevent this
> from happening by making a setIgnoreFlush(true) call on each
> new ImagePlus you create.
>
> -wayne
>