Skip to content

Commit

Permalink
Fix bypassed virtual dispatch when restoring state
Browse files Browse the repository at this point in the history
Don't call unqualified (i.e., assumed to be derived) Resize() function
from constructor.
  • Loading branch information
falbrechtskirchinger authored and Flow86 committed Jul 22, 2023
1 parent 938f355 commit c439431
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions libs/s25main/ingameWindows/IngameWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ IngameWindow::IngameWindow(unsigned id, const DrawPoint& pos, const Extent& size
// Save to settings that window is open
SaveOpenStatus(true);

// Load lastPos before it is overwritten when restoring minimized state
const auto lastPos = (windowSettings_ ? windowSettings_->lastPos : DrawPoint::Invalid());

// Restore minimized state
if(windowSettings_ && windowSettings_->isMinimized)
SetMinimized();
{
isMinimized_ = true;
Extent minimizedSize(GetSize().x, contentOffset.y + contentOffsetEnd.y);
Window::Resize(minimizedSize);
}

// Restore last position or center the window
// Load last position or center the window
if(pos == posLastOrCenter)
{
if(lastPos.isValid())
SetPos(lastPos);
if(windowSettings_ && windowSettings_->lastPos.isValid())
SetPos(windowSettings_->lastPos);
else
MoveToCenter();
} else if(pos == posCenter)
Expand Down

0 comments on commit c439431

Please sign in to comment.