assert fails on selecting colony ship production.

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

assert fails on selecting colony ship production.

#1 Post by adrian_broher »

Message:

Code: Select all

freeorion: /home/adrian/Projekte/PatchWork/freeorion/freeorion.git-svn/GG/src/ListBox.cpp:1810: void GG::ListBox::AdjustScrolls(bool): Assertion `!m_vscroll || static_cast<int>(m_vscroll->PageSize()) == ClientHeight() || ClientHeight() < 0' failed.
How to reproduce:

* Start game
* Select production via unused production points warning (the red circle with the exclamation mark left of the empire production points in the top bar)
* left click on the colony ship to add it to the production queue
* The assert above is triggered and printed on the console.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: assert fails on selecting colony ship production.

#2 Post by Dilvish »

I just updated, rebuilt, and am now getting that same assert failure upon opening the ProductionWnd via the righthand Production icon and adding anything other than Evacuation or Supertester Takeover to it. It also crashes with the same error if I build a SUperTester Takeover, on the turn after the Takeover is complete (when the galaxy would become fully visible). It also crashes with the same error if I start with Trith.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: assert fails on selecting colony ship production.

#3 Post by Geoff the Medio »

There are asserts there, for no obvious reason, and with no comments to explain.

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: assert fails on selecting colony ship production.

#4 Post by Bigjoe5 »

It seems to just be asserting that if there is a scroll bar, and the ListBox is visible, the vertical scrollbar's 'PageSize' is the same height as the ListBox. Depending on exactly what 'PageSize' means, it's probably a problem if that's not true...
Warning: Antarans in dimensional portal are closer than they appear.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: assert fails on selecting colony ship production.

#5 Post by Geoff the Medio »

Bigjoe5 wrote:It seems to just be asserting that if there is a scroll bar, and the ListBox is visible, the vertical scrollbar is the same height as the ListBox.
No...?

Code: Select all

assert(!m_vscroll || static_cast<int>(m_vscroll->PageSize()) == ClientHeight() || ClientHeight() < 0);
It's checking:
-is there (not) a vscroll?
-is the scrolling page size equal to the client height?
-is the client height less than 0?

That has nothing to do with the height of the scrollbar or if the scrollbar is visible.

No idea what the client height being negative is about.

The page size being equal to the client height is a sensible goal, but unnecessary, particularly since it is imposed above that the page size is the larger of the line_size and otherwise-calculated page_size.

In this case, I suspect my changes to the line size calculation, so that it is non-zero even if the client size is 0, leads to the actual page size being non-zero in that case, leading to this assert failing.

Edit: Removed those asserts. As far as I can see, they're unnecessary.

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: assert fails on selecting colony ship production.

#6 Post by Bigjoe5 »

Geoff the Medio wrote:
Bigjoe5 wrote:It seems to just be asserting that if there is a scroll bar, and the ListBox is visible, the vertical scrollbar is the same height as the ListBox.
No...?
It's impressive that you managed to quote my post and respond during the ~30 seconds that it actually said that. :?
Geoff the Medio wrote:No idea what the client height being negative is about.
Since this is one of the 'OK' conditions, I assume that this means the window is not being shown or hasn't been sized yet, and therefore it doesn't matter what the size of the scrollbar page is relative to the client height.
Warning: Antarans in dimensional portal are closer than they appear.

Post Reply