[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: disposing objects - again

What about:
gc.setFont(new Font (display, "Courier", 10, SWT.NORMAL));
...
gc.getFont().dispose();

"Veronika Irvine" <veronika_irvine@xxxxxxx> wrote in message
news:bf1hmo$au0$1@xxxxxxxxxxxxxx
> You should assign the font to a variable when you create it so that you
can
> dispose it when you are done.
>
> "Soni" <soni29@xxxxxxxxxxx> wrote in message
> news:oprsc5xpdnf7o9sl@xxxxxxxxxxxx
> > hi,
> > i has recently asked a question about when to dispose objects are was
> > referred to this article:
> > http://www.eclipse.org/articles/swt-design-2/swt-design-2.html
> >
> > the article made sense of things and was very helpful.  but i wanted to
> ask
> > is it then not ok to code like:
> >
> > gc.setFont(new Font (display, "Courier", 10, SWT.NORMAL));
> >
> > the article mentioned " If you created it, you dispose it."  but here i
> > have no reference to the Font object, then how would i dipose of it? or
is
> > this something that's not recommended when working with SWT?
> >
> > Thank you.
> >
> > --
> > Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
>