Hi, After a lot of debugging I finally found out why a program I was testing was crashing sometimes. (The hsqldb AWT frontend - try the org.hsqldb.util.DatabaseManager class from the hsqldb.jar as distributed with OpenOffice for example.) A GtkGraphics object is created differently for realized and un-realized components. When we get a paint event for an unrealized component and try to use the associated GdkGraphics object bad things happen (because NSA_GET_G_PTR returns null in such cases).
The attached hack makes things work for now by just ignoring such paint
events for such objects. It gives:
NOT handling
java.awt.event.PaintEvent[UPDATE,updateRect=java.awt.Rectangle[x=0,y=0,width=360,height=300]]
on org.hsqldb.util.Grid[panel0,0,0,360x300,invalid,parent=panel1] for
UNREALIZED org.hsqldb.util.Grid[panel0,0,0,360x300,invalid,parent=panel1]
I like to debug this a bit further, but I couldn't find good
documentation on the handling of (un)realized GtkComponentPeers. Does
anybody have a link or an explanation of whether or not the above should
ever happen?
Thanks,
Mark
diff -u -r1.100 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java 8 Feb 2006 14:35:10 -0000
1.100
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 9 Feb 2006 12:43:59 -0000
@@ -306,6 +306,13 @@
{
try
{
+ if (! isRealized())
+ {
+ System.err.println("NOT handling " + event
+ + " for UNREALIZED " + awtComponent);
+ break;
+ }
+
Graphics g = getGraphics();
if (awtComponent.getWidth() < 1 || awtComponent.getHeight() < 1)
signature.asc
Description: This is a digitally signed message part

