Skip to content

Commit 8a55f9e

Browse files
Fix bypassed virtual dispatch when restoring state
Don't call unqualified (i.e., assumed to be derived) Resize() function from constructor.
1 parent bc017d0 commit 8a55f9e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

libs/s25main/ingameWindows/IngameWindow.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,19 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size
5454
// Save to settings that window is open
5555
SaveOpenStatus(true);
5656

57-
// Load lastPos before it is overwritten when restoring minimized state
58-
const auto lastPos = (windowSettings_ ? windowSettings_->lastPos : DrawPoint::Invalid());
59-
6057
// Restore minimized state
6158
if(windowSettings_ && windowSettings_->isMinimized)
62-
SetMinimized();
59+
{
60+
isMinimized_ = true;
61+
Extent minimizedSize(GetSize().x, contentOffset.y + contentOffsetEnd.y);
62+
Window::Resize(minimizedSize);
63+
}
6364

64-
// Restore last position or center the window
65+
// Load last position or center the window
6566
if(pos == posLastOrCenter)
6667
{
67-
if(lastPos.isValid())
68-
SetPos(lastPos);
68+
if(windowSettings_ && windowSettings_->lastPos.isValid())
69+
SetPos(windowSettings_->lastPos);
6970
else
7071
MoveToCenter();
7172
} else if(pos == posCenter)

0 commit comments

Comments
 (0)