https://github.com/libsdl-org/Maelstrom/commit/18e0925b6236e324076df271d665b1352ca436ec
From 18e0925b6236e324076df271d665b1352ca436ec Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 1 May 2013 00:06:17 -0700
Subject: [PATCH] Don't reattach the anchor if it isn't changing. This fixes a
bug if there is an element that is anchored to an element in a container.
The container contents reanchor themselves during the traversal of the anchor
list and can reorder it without this change.
---
screenlib/UIArea.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/screenlib/UIArea.cpp b/screenlib/UIArea.cpp
index 0f3ec425..26904c40 100644
--- a/screenlib/UIArea.cpp
+++ b/screenlib/UIArea.cpp
@@ -312,6 +312,10 @@ UIArea::LoadAnchorLocation(rapidxml::xml_node<> *node, const char *name, AnchorL
void
UIArea::SetAnchorElement(UIArea *anchor)
{
+ if (anchor == m_anchor.element) {
+ return;
+ }
+
if (m_anchor.element) {
m_anchor.element->DelAnchoredArea(this);
}