Vladichka wrote:Hello sir, I am experiencing a crash. I am not sure what's causing it.
- Code: Select all
Exception in thread "Haven UI thread" java.lang.IllegalArgumentException: w and h must be > 0
at java.desktop/java.awt.image.Raster.createInterleavedRaster(Raster.java:214)
at haven.TexI.mkbuf(TexI.java:173)
at haven.CompImage.compose(CompImage.java:98)
at haven.ItemInfo$Layout.render(ItemInfo.java:152)
at haven.ItemInfo.longtip(ItemInfo.java:463)
at haven.MenuGrid$PagButton.rendertt(MenuGrid.java:320)
at haven.MenuGrid.tooltip(MenuGrid.java:527)
at haven.Widget.tooltip(Widget.java:1912)
at haven.Widget$TooltipQuery.shandle(Widget.java:1289)
at haven.Widget.handle(Widget.java:892)
at haven.Widget$Event.dispatch(Widget.java:844)
at haven.Widget$PointerEvent.propagation(Widget.java:987)
at haven.Widget$Event.propagate(Widget.java:828)
at haven.Widget.tooltip(Widget.java:1907)
at haven.Widget$TooltipQuery.shandle(Widget.java:1289)
at haven.Widget.handle(Widget.java:892)
at haven.Widget$Event.dispatch(Widget.java:844)
at haven.Widget$PointerEvent.propagation(Widget.java:987)
at haven.Widget$Event.propagate(Widget.java:828)
at haven.Widget.tooltip(Widget.java:1907)
at haven.Widget$TooltipQuery.shandle(Widget.java:1289)
at haven.Widget.handle(Widget.java:892)
at haven.Widget$Event.dispatch(Widget.java:844)
at haven.Widget$PointerEvent.propagation(Widget.java:987)
at haven.Widget$Event.propagate(Widget.java:828)
at haven.Widget.tooltip(Widget.java:1907)
at haven.Widget$TooltipQuery.shandle(Widget.java:1289)
at haven.Widget.handle(Widget.java:892)
at haven.Widget$Event.dispatch(Widget.java:844)
at haven.UI.dispatch(UI.java:642)
at haven.UI.dispatchq(UI.java:647)
at haven.UI.tooltip(UI.java:926)
at haven.UILoop.drawtooltip(UILoop.java:116)
at haven.UILoop.display(UILoop.java:289)
at haven.UILoop$Frame.display(UILoop.java:462)
at haven.UILoop$Frame.run(UILoop.java:510)
at haven.UILoop.run(UILoop.java:566)
at java.base/java.lang.Thread.run(Thread.java:1583)
I am building from master branch from github using Coretto 21 distribution.
I will also provide AI analysis which your humble meatbag is unable to understand (to be honest I'm lazy) but it might help you in your efforts.
- Code: Select all
This is a MenuGrid craft/action tooltip crash from an empty composed tip image.
Cause: Hovering a PagButton builds tip info and always appends ItemInfo.ResourceName. After removing Name, rendertt still sees a non-empty list and calls ItemInfo.longtip.
MenuGrid.java
Lines 284-292
public List<ItemInfo> info() {
if(info == null) {
info = ItemInfo.buildinfo(this, pag.rawinfo);
Resource.Pagina pg = res.layer(Resource.pagina);
if(pg != null)
info.add(new ItemInfo.Pagina(this, pg.text));
info.add(new ItemInfo.ResourceName(this, res.name));
}
ResourceName only draws when Extended mouseover info is on; otherwise tipimg() is null and nothing is added to the layout:
ItemInfo.java
Lines 194-201
public BufferedImage tipimg() {
return((OptWnd.extendedMouseoverInfoCheckBox != null) && OptWnd.extendedMouseoverInfoCheckBox.a ? str.img : null);
}
public void layout(Layout l) {
BufferedImage img = tipimg();
if(img != null)
l.cmp.add(img, new Coord(0, l.cmp.sz.y + img.getHeight()));
If that button has no other tips (no pagina text / no other rawinfo), CompImage.sz stays (0,0) and compose() → TexI.mkbuf throws w and h must be > 0.
When it happens: Hover a menu button that has essentially only a name, with extended mouseover info off.
Fix direction: Guard empty layout in longtip/Layout.render (return null if cmp.sz is zero), and/or skip calling longtip in rendertt when nothing will render. I can apply that if you want.
Have a nice day.
Edit: It consistently reproduces when you hover over menu items that are hidden behind the map widget.
Thanks, I figured out where I introduced this bug, I'll fix it.