From e879a0e14295da6d19f9bd95f3053becd4017340 Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Sun, 4 Dec 2016 04:20:55 -0500 Subject: [PATCH] Fix for issue #577 StringBlock cannot be cloned with the cloner because it is package private and the cloner cannot instantiate one directly. Since it is extremely unlikely (read: impossible) that there would ever be shared StringBlock references between BitmapText objects then it is safe to just clone it directly. It is important to note that BitmapText never really did support clone before and only pretended to... so this wasn't really a regression. --- jme3-core/src/main/java/com/jme3/font/BitmapText.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/font/BitmapText.java b/jme3-core/src/main/java/com/jme3/font/BitmapText.java index 4dfd87aaa..dc4e4bd56 100644 --- a/jme3-core/src/main/java/com/jme3/font/BitmapText.java +++ b/jme3-core/src/main/java/com/jme3/font/BitmapText.java @@ -95,7 +95,12 @@ public class BitmapText extends Node { for( int i = 0; i < textPages.length; i++ ) { textPages[i] = cloner.clone(textPages[i]); } - this.block = cloner.clone(block); + + // Cannot use the cloner to clone the StringBlock because it + // is package private... so we'll forgo the (probably unnecessary) + // reference fixup in this case and just clone it directly. + //this.block = cloner.clone(block); + this.block = block != null ? block.clone() : null; // Change in behavior: The 'letters' field was not cloned or recreated // before. I'm not sure how this worked and suspect BitmapText was just