From 962adc5e3222522d8e0de5c790d92e44a719b9ec Mon Sep 17 00:00:00 2001 From: Andrei Solntsev Date: Tue, 29 Oct 2024 00:13:58 +0200 Subject: [PATCH] #429 [bugfix] make a copy of BFCs otherwise they will disappear when the caller calls "clear" on its own collection. --- .../src/main/java/org/xhtmlrenderer/layout/LayoutState.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/LayoutState.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/LayoutState.java index 381198b56..33a850a74 100644 --- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/LayoutState.java +++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/LayoutState.java @@ -22,6 +22,8 @@ import org.jspecify.annotations.Nullable; import org.xhtmlrenderer.render.MarkerData; +import java.util.ArrayDeque; +import java.util.Collection; import java.util.Deque; /** @@ -47,8 +49,8 @@ public Deque getBFCs() { return _BFCs; } - public void setBFCs(Deque s) { - _BFCs = s; + public void setBFCs(Collection s) { + _BFCs = new ArrayDeque<>(s); } @Nullable