Bug 23557 - JComboBox under Graphics2D crashes VM and GTK
Summary: JComboBox under Graphics2D crashes VM and GTK
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: swing (show other bugs)
Version: unspecified
: P1 critical
Target Milestone: 0.18
Assignee: Lillian Angel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-25 09:24 UTC by Norman Hendrich
Modified: 2005-11-16 20:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-16 20:04:55


Attachments
testcase for demonstration of the bug (365 bytes, text/plain)
2005-08-25 09:26 UTC, Norman Hendrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Norman Hendrich 2005-08-25 09:24:13 UTC
Please compile and run the attached testcase with a Graphics2D-enabled
Classpath (./configure ... --enable-gtk-cairo) for an instant VM crash.
The partially created GTK window remains open and has to be killed via
the taskmanager. 

I tried classpath CVS 20050825 with jamvm 1.3.1. I can run a few of my
Graphics2D tests with this combination, so basic Graphics2D support on
Swing is working. The testcase also works with the JComboBox not added
to the JFrame.

Note: Running the testcase with a 'normal' (non-Graphics2D Classpath) 
also shows some minor problems in JComboBox, see follow-up PR.

I get the following shell output:

** ERROR **: file gnu_java_awt_peer_gtk_GdkGraphics2D.c: line 1257 (Java_gnu_jav
a_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector): assertion failed: (glyphs !=
 NULL)
aborting...
java.lang.InternalError
   at gnu.java.awt.peer.gtk.GdkGraphics2D.cairoDrawGlyphVector (Native Method)
   at gnu.java.awt.peer.gtk.GdkGraphics2D.drawGlyphVector (GdkGraphics2D.java:15
35)
   at gnu.java.awt.peer.gtk.GdkGraphics2D.drawString (GdkGraphics2D.java:1514)
   at gnu.java.awt.peer.gtk.GdkGraphics2D.drawString (GdkGraphics2D.java:1520)
   at javax.swing.plaf.basic.BasicButtonUI.paintText (BasicButtonUI.java:405)
   at javax.swing.plaf.basic.BasicButtonUI.paint (BasicButtonUI.java:287)
   at javax.swing.plaf.ComponentUI.update (ComponentUI.java:187)
   at javax.swing.JComponent.paintComponent (JComponent.java:1521)
   at javax.swing.JComponent.paint (JComponent.java:1454)
   at javax.swing.plaf.basic.BasicArrowButton.paint (BasicArrowButton.java:206)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1765)
   at java.awt.Container.visitChild (Container.java:1569)
   at java.awt.Container.visitChildren (Container.java:1531)
   at java.awt.Container.paint (Container.java:764)
   at javax.swing.JComponent.paintChildren (JComponent.java:1498)
   at javax.swing.JComponent.paint (JComponent.java:1456)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1765)
   at java.awt.Container.visitChild (Container.java:1569)
   at java.awt.Container.visitChildren (Container.java:1531)
   at java.awt.Container.paint (Container.java:764)
   at javax.swing.JComponent.paintChildren (JComponent.java:1498)
   at javax.swing.JComponent.paint (JComponent.java:1456)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1765)
   at java.awt.Container.visitChild (Container.java:1569)
   at java.awt.Container.visitChildren (Container.java:1531)
   at java.awt.Container.paint (Container.java:764)
   at javax.swing.JComponent.paintChildren (JComponent.java:1498)
   at javax.swing.JComponent.paint (JComponent.java:1456)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1765)
   at java.awt.Container.visitChild (Container.java:1569)
   at java.awt.Container.visitChildren (Container.java:1531)
   at java.awt.Container.paint (Container.java:764)
   at javax.swing.JComponent.paintChildren (JComponent.java:1498)
   at javax.swing.JComponent.paint (JComponent.java:1456)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1765)
   at java.awt.Container.visitChild (Container.java:1569)
   at java.awt.Container.visitChildren (Container.java:1531)
   at java.awt.Container.paint (Container.java:764)
   at gnu.java.awt.peer.gtk.GtkComponentPeer.handleEvent (GtkComponentPeer.java:
313)
   at java.awt.Component.dispatchEventImpl (Component.java:4845)
   at java.awt.Container.dispatchEventImpl (Container.java:1592)
   at java.awt.Window.dispatchEventImpl (Window.java:628)
   at java.awt.Component.dispatchEvent (Component.java:2343)
   at java.awt.EventQueue.dispatchEvent (EventQueue.java:475)
   at java.awt.EventDispatchThread.run (EventDispatchThread.java:75)
Abort
Comment 1 Norman Hendrich 2005-08-25 09:26:26 UTC
Created attachment 9583 [details]
testcase for demonstration of the bug
Comment 2 Thomas Fitzsimmons 2005-09-02 04:46:10 UTC
Fixed.  Closing.
Comment 3 cvs-commit@developer.classpath.org 2005-09-02 05:21:48 UTC
Subject: Bug 23557

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Branch: 	
Changes by:	Thomas Fitzsimmons <fitzsim@savannah.gnu.org>	05/09/02 04:42:23

Modified files:
	.              : ChangeLog 
	gnu/java/awt/peer/gtk: GdkGraphics2D.java 

Log message:
	2005-09-02  Thomas Fitzsimmons  <fitzsim@redhat.com>
	
	PR awt/23557
	* gnu/java/awt/peer/gtk/GdkGraphics2D.java (drawString(String,
	float, float)): Return immediately if string is null or
	zero-length.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.4615&tr2=1.4616&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java.diff?tr1=1.43&tr2=1.44&r1=text&r2=text




Comment 4 Norman Hendrich 2005-09-23 08:45:13 UTC
Broken again, probably due to the recent UIDelegate refactoring.
Now crashes with a NPE:

java/xxx> jamvm PR23557
Exception during event dispatch:
java.lang.NullPointerException
   at javax.swing.plaf.metal.MetalComboBoxButton.paintComponent (MetalComboBoxBu
tton.java:212)
   at javax.swing.JComponent.paint (JComponent.java:1452)
   at javax.swing.JComponent.paintChildren (JComponent.java:1512)
   at javax.swing.JComponent.paint (JComponent.java:1454)
   at javax.swing.JComponent.paintChildren (JComponent.java:1512)
   at javax.swing.JComponent.paint (JComponent.java:1454)
   at javax.swing.JComponent.paintChildren (JComponent.java:1512)
   at javax.swing.JComponent.paint (JComponent.java:1454)
   at javax.swing.JLayeredPane.paint (JLayeredPane.java:687)
   at javax.swing.JComponent.paintChildren (JComponent.java:1512)
   at javax.swing.JComponent.paint (JComponent.java:1454)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1817)
   at java.awt.Container.visitChild (Container.java:1621)
   at java.awt.Container.visitChildren (Container.java:1583)
   at java.awt.Container.paint (Container.java:769)
   at gnu.java.awt.peer.gtk.GtkComponentPeer.handleEvent (GtkComponentPeer.java:
313)
Comment 5 david.gilbert 2005-09-23 11:12:55 UTC
I'll take a look at this one.
Comment 6 david.gilbert 2005-09-29 11:02:51 UTC
This is a new problem rather than a recurrence of the original.  It is fixed in
CVS now, please retest.
Comment 7 Norman Hendrich 2005-09-29 11:33:28 UTC
Subject: Re:  JComboBox under Graphics2D crashes VM and GTK


> 2005-09-29 11:02 -------
> This is a new problem rather than a recurrence of the original.  It is fixed 
> in CVS now, please retest.
 
OK, I did a 'cvs update' right now and rebuilt my clean cvs checkout
from 08:30 today.

Admittedly, the PR23557 testcase starts instead of crashing the VM,
but I wouldn't call it fixed... (SuSE Linux x86, jamvm 1.3.2, ctwm 
WindowManager):

With Graphics2D enabled, the main window appears, but I get the
Graphics2D.copyArea UnsupportedOperationException as soon as I try
to open the JComboBox drop-down list:

/opt/jamvm/bin/jamvm -mx200m -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D PR23557
Exception during event dispatch:
java.lang.UnsupportedOperationException
   at gnu.java.awt.peer.gtk.GdkGraphics2D.copyArea (GdkGraphics2D.java:1397)
   at javax.swing.JViewport.paintBackingStore (JViewport.java:817)
   at javax.swing.JViewport.paintBlit (JViewport.java:870)
   at javax.swing.JViewport.paint (JViewport.java:499)
   at javax.swing.JComponent.paintChildren (JComponent.java:1539)
   at javax.swing.JComponent.paint (JComponent.java:1476)
   at javax.swing.JComponent.paintChildren (JComponent.java:1539)
   ...
   
   
Without Graphics2D, I can open the drop-down list, but the drop-down-
list-window is way to big, and gets BIGGER each time I open it anew. 
This is pretty funny to watch, but not really useable. Also, clicking
somewhere outside the actual text-labels in the big drop-down window
crashes:

Exception during event dispatch:
java.lang.IndexOutOfBoundsException
   at java.util.BitSet.set (BitSet.java:632)
   at javax.swing.DefaultListSelectionModel.setSelectionInterval 
(DefaultListSelectionModel.java:527)
   at javax.swing.JList.setSelectedIndex (JList.java:1264)
   at javax.swing.plaf.basic.BasicComboPopup$ListMouseMotionHandler.mouseMoved 
(BasicComboPopup.java:923)
   at java.awt.AWTEventMulticaster.mouseMoved (AWTEventMulticaster.java:393)
   at java.awt.Component.processMouseMotionEvent (Component.java:3141)
   at javax.swing.JComponent.processMouseMotionEvent (JComponent.java:28
   
   
   

Comment 8 david.gilbert 2005-09-29 12:25:40 UTC
The problem with Graphics2D is almost certainly due to this patch:

> I implemented a little optimization to MetalUtils.fillMetalPattern, that
> uses Graphics2D if it gets one. The pattern drawing is then performed via
> TexturePaint. Unfortunatly this segfaults with the current GTK-Cairo
> Graphics2D, so I cannot test this. However, I still commit this, since
> this patch otherwise blocks other patches I have.
> 
> 2005-09-28  Roman Kennke  <kennke@aicas.com>
> 
>        * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
>        (paintPalette): Use new MetalUtils.fillMetalPattern signature.
>        (paintComponent): Use new MetalUtils.fillMetalPattern signature.
>
> /Roman

Roman or someone else will have to comment on how that is being dealt with.

There's certainly more than one bug in the JComboBox code, and I'll continue
hunting them down.  Thanks for all the feedback.


Comment 9 Norman Hendrich 2005-09-29 12:48:18 UTC
Subject: Re:  JComboBox under Graphics2D crashes VM and GTK


> The problem with Graphics2D is almost certainly due to this patch:
> [...]

Well, I don't see SEGVs in PR23557 at the moment, but just Unsupported-
OperationExceptions because Graphics2D.copyArea() is not implemented yet.

This in turn is due to a change in the Swing repaint mechanism that
Roman checked in a few days ago: the 2005-09-22 JViewport patch.

As copyArea() is required for almost all non-trivial applications somewhere,
Swing with Graphics2D enabled is more or less pointless at the moment.
I submitted this as PR24099.

- Norman

Comment 10 Roman Kennke 2005-09-29 14:04:49 UTC
Hi,

> This in turn is due to a change in the Swing repaint mechanism that
> Roman checked in a few days ago: the 2005-09-22 JViewport patch.

> As copyArea() is required for almost all non-trivial applications somewhere,
> Swing with Graphics2D enabled is more or less pointless at the moment.
> I submitted this as PR24099.

yeah, that was my patch. The same goes for painting with textures, which is
segfaulting and preventing Swing and Graphics2D to go together.
Comment 11 david.gilbert 2005-09-29 14:12:40 UTC
> Without Graphics2D, I can open the drop-down list, but the drop-down-
> list-window is way to big, and gets BIGGER each time I open it anew. 
> This is pretty funny to watch, but not really useable. Also, clicking
> somewhere outside the actual text-labels in the big drop-down window
> crashes:

I've posted a patch to the classpath-patches mailing list that fixes this
particular problem.  I'll keep you posted if it passes review.
Comment 12 david.gilbert 2005-10-06 12:54:34 UTC
An update on the status of this bug.  My patch was approved and committed:

http://lists.gnu.org/archive/html/classpath-patches/2005-09/msg00646.html

...but later overwritten due to problems with menus:

http://lists.gnu.org/archive/html/classpath-patches/2005-09/msg00687.html

I don't know how to resolve this.  Later when I have more time I will come back to it, study the menu layout code, and see if I can find a solution.  But that won't be in the short term, so if anyone else wants to take a look at it, go ahead.  I'll reassign this to default.
Comment 13 Lillian Angel 2005-11-16 18:33:01 UTC
This appears to fixed in CVS HEAD
Comment 14 Norman Hendrich 2005-11-16 18:46:30 UTC
Subject: Re:  JComboBox under Graphics2D crashes VM and GTK

Hello Lillian,

> This appears to fixed in CVS HEAD

well, admittedly it doesn't crash the VM anymore, but running the PR2557
testcase on jamvm 1.3.2 linux-x86 with Graphics2D enabled, I get a lot of 
assertion errors when I select an item from the JComboBox. - see below. 
Are you sure this is 'RESOLVED FIXED'?

- Norman


(.:1571): Gdk-CRITICAL **: gdk_drawable_get_size: assertion `GDK_IS_DRAWABLE (dr
awable)' failed
java.lang.InternalError: Gdk: gdk_drawable_get_size: assertion `GDK_IS_DRAWABLE 
(drawable)' failed
   at gnu.java.awt.peer.gtk.GdkGraphics2D.gdkDrawDrawable (Native Method)
   at gnu.java.awt.peer.gtk.GdkGraphics2D.copyArea (GdkGraphics2D.java:1406)
   at javax.swing.JViewport.paintBackingStore (JViewport.java:827)
   at javax.swing.JViewport.paintBlit (JViewport.java:880)
   at javax.swing.JViewport.paint (JViewport.java:493)
   at javax.swing.JComponent.paintChildren (JComponent.java:1796)
   at javax.swing.JComponent.paint (JComponent.java:1700)
   at javax.swing.JComponent.paintChildren (JComponent.java:1796)
   at javax.swing.JComponent.paint (JComponent.java:1700)
   at javax.swing.JComponent.paintChildren (JComponent.java:1796)
   at javax.swing.JComponent.paint (JComponent.java:1700)
   at javax.swing.JComponent.paintChildren (JComponent.java:1796)
   at javax.swing.JComponent.paint (JComponent.java:1700)
   at javax.swing.JLayeredPane.paint (JLayeredPane.java:705)
   at javax.swing.JComponent.paintChildren (JComponent.java:1796)
   at javax.swing.JComponent.paint (JComponent.java:1700)
   at javax.swing.JComponent.paintDoubleBuffered (JComponent.java:1923)
   at javax.swing.JComponent.paint (JComponent.java:1692)
   at java.awt.Container$GfxPaintVisitor.visit (Container.java:1838)
   at java.awt.Container.visitChild (Container.java:1642)
   at java.awt.Container.visitChildren (Container.java:1604)
   at java.awt.Container.paint (Container.java:790)
   at gnu.java.awt.peer.gtk.GtkComponentPeer.handleEvent (GtkComponentPeer.java:
318)
   at java.awt.Component.dispatchEventImpl (Component.java:4850)
   at java.awt.Container.dispatchEventImpl (Container.java:1665)
   at java.awt.Window.dispatchEventImpl (Window.java:623)
   at java.awt.Component.dispatchEvent (Component.java:2342)
   at java.awt.EventQueue.dispatchEvent (EventQueue.java:474)
   at java.awt.EventDispatchThread.run (EventDispatchThread.java:75)

Comment 15 Lillian Angel 2005-11-16 19:01:11 UTC
Sorry Norman, I thought it was fixed because of the previous comments I had read. I thought the only problem remaining was the one David referred to (combo box increasing in size). That seemed to be fixed.

I will test this with Graphics2D enabled.

Thanks!
Comment 16 Norman Hendrich 2005-11-16 19:14:17 UTC
Subject: Re:  JComboBox under Graphics2D crashes VM and GTK

Hello Lillian,

I just realized that the assertion errors on PR23557 are probably
the same as for PR24099. So, the JComboBox issue might be solved
after all, and only the copyArea() problem remains.

- Norman

Comment 17 Lillian Angel 2005-11-16 20:53:36 UTC
Fixed