UI::Panel::get_inner_h() const: Assertion `tborder_ + bborder_ <= h_' failed.

Bug #1653460 reported by kaputtnik on 2017-01-01
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

Sometimes i get this crash:

/trunk/src/ui_basic/panel.h:188: int UI::Panel::get_inner_h() const: Assertion `tborder_ + bborder_ <= h_' failed.

First i thought this crash happens only for window "You won the game", but today i got it in the middle of a game. Can't remember trying to open a window at all at this point in the game.

The output.txt shows the terminal output. Backtrace will follow.

To reproduce, select "Watch Replay" and then "Back" repeatedly.

Related branches

kaputtnik (franku) wrote :
kaputtnik (franku) wrote :

I observed

int UI::Panel::get_inner_w() const: Assertion `lborder_ + rborder_ <= w_' failed.

which may be related.

kaputtnik (franku) wrote :

Alexander, do you have a multi monitor setup?

On the machine where i encountered this i do use two monitors, both with the same resolution. widelands is running on the right monitor then.

Maybe related: bug 1656619

Changed in widelands:
status: New → Confirmed
status: Confirmed → Incomplete
SirVer (sirver) wrote :

I also see this occasionally, but found no instance of how to repro. I have two monitors most of the times, Widelands runs on the larger one:

Resolution: 2880 x 1800 Retina (so this means it is 1440x900 normal)
Resolution: 3440 x 1440 @ 60 Hz

kaputtnik (franku) wrote :

I can trigger this segfault:

int UI::Panel::get_inner_w() const: Zusicherung »lborder_ + rborder_ <= w_« nicht erfüllt.

now every time i try to open "Watch replay".

- bzr8241
- Window mode
- Resolution 1440x900
- Two monitors, each with resolution 1680x1050

Backtrace attached, output of valgrind attached

kaputtnik (franku) wrote :
kaputtnik (franku) wrote :

Don't know if this is related:

I compiled this branch without debugging symbols


The "Watch Replay" then looks like the screenshot.

GunChleoc (gunchleoc) wrote :

While accessing the internet lobby, I just got one in button.cc:202:

  const Image* entry_text_im =
     autofit_ui_text(title_, get_inner_w() - 2 * kButtonImageMargin,
                     enabled_ ? UI_FONT_CLR_FG : UI_FONT_CLR_DISABLED);

I guess these are coming from the new dynamic layouts for fullscreen, where some panels might be initialized with 0 width/height before their actual width/height is set in the layout() function.

How about rewriting the functions a bit? Instead of:

 int get_inner_w() const {
  assert(lborder_ + rborder_ <= w_);
  return w_ - (lborder_ + rborder_);

We could have:

 int get_inner_w() const {
  assert(w_ == 0 || lborder_ + rborder_ <= w_);
  return (w_ == 0 ? 0 : w_ - (lborder_ + rborder_);

GunChleoc (gunchleoc) on 2017-01-22
Changed in widelands:
status: Incomplete → Confirmed
milestone: none → build20-rc1
importance: Undecided → High
Changed in widelands:
status: Confirmed → In Progress

OK I can confirm this is cause by more dynamic layouts,
where w_ og h_ (would) become negative for a while.

Changing the Assertion will not help in this case.
I will try to add some minumu widht and height.

The Alternative would be to first layout() without assertions
and then check the layout later. (As of my experience this
will result in some ugly circular layout issues.

Table::layout() uses uint32 for column width which results in some ugly mix of underflow and casrt back to int.

GunChleoc (gunchleoc) wrote :

We should replace all the uints in ui_basic with ints.

GunChleoc (gunchleoc) on 2017-02-26
Changed in widelands:
assignee: nobody → GunChleoc (gunchleoc)
GunChleoc (gunchleoc) on 2017-02-27
description: updated
tags: added: crash ui
kaputtnik (franku) wrote :
GunChleoc (gunchleoc) on 2017-03-04
Changed in widelands:
status: In Progress → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers