Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT produce a VM failure on a GC.getFontMetrics() call.

Deleting GDI resources (FONTs BRUSHes etc.) on Win32, which are still selected in HDC(= SWT GC) does not lead to crash most of the time. This is by design of Win32, not of SWT/Win32.
I mean, even if you do this same error in a C/Win32 program, it will not crash.
 
Unfortunately, this is not the case for other platforms, esp. GTK+, where the font resource is a C structure, which when disposed while still selected in graphics context will lead to crash..
 
----- Original Message -----
Sent: Friday, October 08, 2004 6:47 PM
Subject: Re: [platform-swt-dev] SWT produce a VM failure on a GC.getFontMetrics() call.


To add water to your mill ...
Same code on Windows doesn't raise any crash,
In one hand: isDisposed() check is done for swt-win32 port, or
in other hand swt-win32 port do a copy of font at GC.setFont() and use it, meaning
that user (me) can dispose the font without crashing ...

Ok, the bug here is that I wrote bad code: no more crash until I correct it (do not dispose until font is used in gc ...).
Thanks,
Arnaud.



Mike Wilson <Mike_Wilson@xxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

10/08/2004 04:48 PM

Please respond to
platform-swt-dev

To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
Re: [platform-swt-dev] SWT produce a VM failure on a GC.getFontMetrics() call.





True, but that does excuse the fact that SWT crashed. Seems like another
place where an isDisposed check is needed.

McQ.




Arnaud De Muyser <ademuyser@xxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
10/08/04 09:03
Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-swt-dev] SWT produce a VM failure on a GC.getFontMetrics()
call.







Seek in it before sent mail .... Sorry.

This is due to the following situation:

Font font = new Font( ... );
gc.setFont( font );
font.dispose();
gc.getFontMetrics() => core.

The right think is to not dispose font after set it in a gc ...



Arnaud De Muyser/France/IBM@IBMFR
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
10/08/2004 02:37 PM

Please respond to
platform-swt-dev


To
platform-swt-dev@xxxxxxxxxxx
cc

Subject
[platform-swt-dev] SWT produce a VM failure on a GC.getFontMetrics() call.









Does anyone have already seen this kind of joke ?
Using Eclipse SDK 3.0.1 on a Linux Suse.
Thanks for your help.
Arnaud.


** (<unknown>:668): CRITICAL **: file pango-fontmap.c: line 126
(pango_font_map_load_fontset): assertion
`pango_font_description_get_family (desc) != NULL' failed

** (<unknown>:668): CRITICAL **: file pango-fontset.c: line 101
(pango_fontset_get_metrics): assertion `fontset != NULL' failed

(<unknown>:668): GLib-GObject-CRITICAL **: file gobject.c: line 1337
(g_object_unref): assertion `G_IS_OBJECT (object)' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1206
(pango_font_metrics_get_ascent): assertion `metrics != NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1226
(pango_font_metrics_get_descent): assertion `metrics != NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1245
(pango_font_metrics_get_approximate_char_width): assertion `metrics !=
NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1182
(pango_font_metrics_unref): assertion `metrics != NULL' failed

** (<unknown>:668): CRITICAL **: file pango-fontmap.c: line 126
(pango_font_map_load_fontset): assertion
`pango_font_description_get_family (desc) != NULL' failed

** (<unknown>:668): CRITICAL **: file pango-fontset.c: line 101
(pango_fontset_get_metrics): assertion `fontset != NULL' failed

(<unknown>:668): GLib-GObject-CRITICAL **: file gobject.c: line 1337
(g_object_unref): assertion `G_IS_OBJECT (object)' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1206
(pango_font_metrics_get_ascent): assertion `metrics != NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1226
(pango_font_metrics_get_descent): assertion `metrics != NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1245
(pango_font_metrics_get_approximate_char_width): assertion `metrics !=
NULL' failed

** (<unknown>:668): CRITICAL **: file fonts.c: line 1182
(pango_font_metrics_unref): assertion `metrics != NULL' failed

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x400E49DF
Function=strlen+0xF
Library=/lib/libc.so.6

Current Java thread:
      at org.eclipse.swt.internal.gtk.OS.pango_context_get_metrics(Native
Method)
      - locked <0x4831db20> (a java.lang.Class)
      at org.eclipse.swt.graphics.GC.getFontMetrics(GC.java:1472)
              at ....

and Sun's VM (1.4.2) produce a core file ...

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top