Roman Kennke wrote:
Am Dienstag, den 05.12.2006, 10:57 +0100 schrieb Mark Wielaard:
On Tue, 2006-12-05 at 10:47 +0100, Roman Kennke wrote:
Am Montag, den 04.12.2006, 19:21 -0500 schrieb Thomas Fitzsimmons:
This patch makes Component.getFont always return a non-null Font. This fixes a
NullPointerException thrown by MegaMek. I committed this fix to trunk and
classpath-0_93-branch.
Hmm. While this makes the method more safe, I don't think that's 100%
correct. When a component has no parent or doesn't get a font from a
parent it indeed returns null. The WindowPeer seems to be responsible
for setting a font on the toplevel window AFAICS.
It also fixed an issue for me with jedit (it makes the Plugins ->
Plugins Options menu and dialog work for, so you can actually set the
font for the QuickNotepad). If we cannot come up with something better I
would like to ship with this patch. But it is not ideal, seeing that it
did introduce mauve regressions for:
FAIL: java.awt.Component.getFont
FAIL: javax.swing.JComponent.getFont
FAIL: javax.swing.JLabel.constructor
FAIL: javax.swing.plaf.basic.BasicComboBoxUI.createRenderer
FAIL: javax.swing.plaf.metal.MetalComboBoxUI.getMinimumSize
FAIL: javax.swing.plaf.metal.MetalComboBoxUI.getPreferredSize
It did also provide a new PASS however:
PASS:
javax.swing.table.JTableHeader.AccessibleJTableHeader.AccessibleJTableHeaderEntry.getFont
Very strange. I'd say go for it for the release branch and let's really
fix it on HEAD.
For a start it would be interesting what is the toplevel parent and why
does it have font==null? We already set the font in GtkWindowPeer
constructor so we should be ok.
The specific problem with MegaMek is that doLayout is being called from
ScrollPane.addImpl before the ScrollPane is added to its parent dialog
window. I committed a Mauve test that demonstrates this problem. While
working on a fix I discovered that ScrollPane is broken in other ways
too. I'm working on a patch.
Tom