From 22c49d9159228bf5abaec78ea07034626d98061d Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Sun, 17 Jul 2022 13:08:57 +0200 Subject: [PATCH] Fixed crash when position of ChildWindow depends on its size --- src/Widgets/ChildWindow.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Widgets/ChildWindow.cpp b/src/Widgets/ChildWindow.cpp index 155565983..aef1ef6f0 100644 --- a/src/Widgets/ChildWindow.cpp +++ b/src/Widgets/ChildWindow.cpp @@ -125,7 +125,6 @@ namespace tgui void ChildWindow::setPosition(const Layout2d& position) { - Layout2d containerPos = position; if (m_keepInParent && m_parent && (m_parent->getSize().x > 0) && (m_parent->getSize().y > 0)) { const Vector2f origin{getOrigin().x * getSize().x, getOrigin().y * getSize().y}; @@ -144,11 +143,11 @@ namespace tgui else if (x > m_parent->getSize().x - getSize().x) x = std::max(0.f, m_parent->getSize().x - getSize().x); - containerPos = {x + origin.x, y + origin.y}; + Container::setPosition({x + origin.x, y + origin.y}); } } - - Container::setPosition(containerPos); + else + Container::setPosition(position); // Calculate the distance from the right side that the buttons will need float buttonOffsetX = 0;