Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Figure#setFont does not dispose the existing font
Figure#setFont does not dispose the existing font [message #454448] Thu, 21 April 2005 00:07 Go to next message
Kevin is currently offline KevinFriend
Messages: 34
Registered: July 2009
Member
public void setFont (Font f) {
if (font != f) {
font = f;
revalidate ();
}
}

Should the font be disposed first before it is set to the new one?

public void setFont (Font f) {
if (font != f) {
if (font != null)
font.dispose();
font = f;
revalidate ();
}
}

If not, I think I should cache the newFont in my Figure derived class. But
the Figure does not have the dispose method. When should I dispose it?
Re: Figure#setFont does not dispose the existing font [message #454466 is a reply to message #454448] Thu, 21 April 2005 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Are you talking about GEF? The figure doesn't own the font, so it is not
responsible to dispose it. The caller is the one who owns it and should
dispose when no longer needed. Since a font can be shared between
figures it would be a mess if one figure decided to dispose it while the
others are still using it.


--
Thanks,
Rich Kulp
Re: Figure#setFont does not dispose the existing font [message #454475 is a reply to message #454466] Thu, 21 April 2005 19:03 Go to previous message
Kevin is currently offline KevinFriend
Messages: 34
Registered: July 2009
Member
Oops. Sorry, I post to the wrong group.

Yes, you answer my question. It makes sense.

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:d48apv$7sk$1@news.eclipse.org...
> Are you talking about GEF? The figure doesn't own the font, so it is not
> responsible to dispose it. The caller is the one who owns it and should
> dispose when no longer needed. Since a font can be shared between
> figures it would be a mess if one figure decided to dispose it while the
> others are still using it.
>
>
> --
> Thanks,
> Rich Kulp
Previous Topic:links in a Browser widget
Next Topic:bind system.out stream to SWT text widget
Goto Forum:
  


Current Time: Thu Mar 04 13:21:56 GMT 2021

Powered by FUDForum. Page generated in 0.02332 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top