Skip to content

Commit cababba

Browse files
HeikoKlarefedejeanne
authored andcommitted
[Win32] Do not initialize font when already disposed
The on-demand creation of Font handles does not consider that a font may already have been disposed when first retrieving it's handle, which triggers the on-demand initialization. To avoid that this initialization after disposal fails, this change adds a check for the font being destroyed when performing the initialization. Fixes eclipse-platform/eclipse.platform.ui#2960
1 parent b8d884b commit cababba

File tree

1 file changed

+1
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+1
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public String toString () {
312312
* @noreference This method is not intended to be referenced by clients.
313313
*/
314314
public static long win32_getHandle(Font font) {
315-
if (font.handle == 0 && font.fontData != null) {
315+
if (font.handle == 0 && font.fontData != null && !font.isDestroyed) {
316316
font.init(font.fontData);
317317
}
318318
return font.handle;

0 commit comments

Comments
 (0)