Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [RAP] Font.equals with disposed fonts
[RAP] Font.equals with disposed fonts [message #1699915] Mon, 29 June 2015 09:09
Jerome Sivadier is currently offline Jerome SivadierFriend
Messages: 15
Registered: May 2015
Junior Member
Dear SWT community,

I'm currently using SWT and draw2d for RAP and I'm not sure if I should post here or in the RAP forum. My problem is located in the jars "org.eclipse.rap.rwt_2.3.2.20150128-1013.jar" and "org.eclipse.rap.draw2d_0.1.0.20141203-1509.jar".

Actually in my RAP application, the layout managers are calling FlowUtilities#getAverageCharWidth with a "Font {Arial,10,NORMAL}". Then this method calls FigureUtilities#getFontMetrics with that same font, and this last method calls its internal #setFont to change the current FigureUtilities cached font.

The problem is that internally FigureUtilities has another Font stored with the exact same FontData: "Font {Arial,10,NORMAL}" but this font is DISPOSED. Indeed when the method setFont is called, the fonts are compared and both are qualified EQUALS because the Font#equals method does not check if the Font is disposed...

Is this a normal behavior? Should the equals method return false when a Font is disposed and the other not, but they have the exact same FontData? Should I never encounter this behavior?

Thanks for any answer.

EDIT: I've just fixed in my local instance the problem by doing a checkout on "org.eclipse.rap.draw2d" and modifying the "FigureUtilities#setFont" to check for disposed Fonts. It works as expected. Indeed I guess it's not a SWT bug but a RCP Draw2d bug so if a moderator could move my message into the right forum (RAP / Incubator) it would be appreciated Smile.

[Updated on: Mon, 29 June 2015 15:30]

Report message to a moderator

Previous Topic:Combo Autill Based On User Entry
Next Topic:Win7 taskbar grouping
Goto Forum:

Current Time: Fri Jan 22 03:36:11 GMT 2021

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

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

Back to the top