From 8a55f9e356bbc3571fb684b505b4dddd1b8b2a98 Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Tue, 18 Jul 2023 19:38:07 +0200 Subject: [PATCH] Fix bypassed virtual dispatch when restoring state Don't call unqualified (i.e., assumed to be derived) Resize() function from constructor. --- libs/s25main/ingameWindows/IngameWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/s25main/ingameWindows/IngameWindow.cpp b/libs/s25main/ingameWindows/IngameWindow.cpp index 34ab66606..5a48f62d2 100644 --- a/libs/s25main/ingameWindows/IngameWindow.cpp +++ b/libs/s25main/ingameWindows/IngameWindow.cpp @@ -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)