-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
Milestone
Description
As mentioned in point Nr. 3 of #98 (comment) (pasted below), this could lead to problems if someone changes the internal state of fontData.
3.
org.eclipse.swt.internal.ScalingSWTFontRegistry.fontKeyMapusesFontDataas key(Same problem for
org.eclipse.swt.internal.DefaultSWTFontRegistry.fontsMap).
FontDatais not immutable which may lead to information getting lost.Example
public static void main(String[] args) { Map<FontData, String> map = new HashMap<>(); FontData fontData = new FontData("f1", 10, 10); map.put(fontData, "found!"); System.out.println(map.get(fontData)); fontData.height += 1; System.out.println(map.get(fontData)); }Produces the output:
found! null
Task
Make the key in the registry map immutable. Possible options are:
- Clone the FontData used as key so that no one outside the registry has access to it and may modify it
- Find some other kind of key that is both unique and immutable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done