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:Default Font for all OS?
Goto Forum:
  


Current Time: Thu Apr 18 04:36:40 GMT 2024

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

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

Back to the top