Change recursion to iteration. This is a bit more efficient, but also I've observed a stack overflow error with this recursion - so maybe iteration will help, unless there's another underlying logic error (e.g. a cycle).

This commit is contained in:
Myrd
2014-12-29 17:45:52 +00:00
parent 3d2156b429
commit 41a1c9b5e5

View File

@@ -81,6 +81,7 @@ public abstract class VCardDisplayArea extends VDisplayArea implements ActivateH
//support adding card panel and attached panels to display area recursively
private void addCardPanelToDisplayArea(CardAreaPanel cardPanel) {
do {
List<CardAreaPanel> attachedPanels = cardPanel.getAttachedPanels();
if (!attachedPanels.isEmpty()) {
for (int i = attachedPanels.size() - 1; i >= 0; i--) {
@@ -93,9 +94,8 @@ public abstract class VCardDisplayArea extends VDisplayArea implements ActivateH
}
add(cardPanel);
if (cardPanel.getNextPanelInStack() != null) {
addCardPanelToDisplayArea(cardPanel.getNextPanelInStack());
}
cardPanel = cardPanel.getNextPanelInStack();
} while (cardPanel != null);
}
public final void removeCardPanel(final CardAreaPanel fromPanel) {