Gabriel95 / scalafx

Automatically exported from code.google.com/p/scalafx
Other
0 stars 0 forks source link

SFX-8: `ColorfulCircles` and `SimpleColorfulCircles` demos fail #69

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
scalafx.ColorfulCircles and SimpleColorfulCircles fail with StackOverflowError 
in ScalaFX 8. Tested with Java 8 ea b100.

Part of the error message and stack trace is below (full message and trace are 
very long): 

com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
WARNING: Exception while evaluating select-binding [width]
com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
WARNING: Exception while evaluating select-binding [width]
com.sun.javafx.binding.SelectBinding$SelectBindingHelper getObservableValue
WARNING: Exception while evaluating select-binding [width]
...
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application 
start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:867)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.StackOverflowError
    at com.sun.javafx.binding.SelectBinding$SelectBindingHelper.getObservableValue(SelectBinding.java:481)
    at com.sun.javafx.binding.SelectBinding$AsDouble.computeValue(SelectBinding.java:190)
    at javafx.beans.binding.DoubleBinding.get(DoubleBinding.java:203)
    at javafx.beans.property.DoublePropertyBase.get(DoublePropertyBase.java:133)
    at javafx.scene.shape.Rectangle.getWidth(Rectangle.java:235)
    at javafx.scene.shape.Rectangle.toString(Rectangle.java:564)
    at java.lang.String.valueOf(String.java:2985)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at javafx.beans.property.ReadOnlyObjectProperty.toString(ReadOnlyObjectProperty.java:69)
    at java.lang.String.valueOf(String.java:2985)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.sun.javafx.binding.SelectBinding$SelectBindingHelper.getObservableValue(SelectBinding.java:501)
    at com.sun.javafx.binding.SelectBinding$AsDouble.computeValue(SelectBinding.java:190)
    at javafx.beans.binding.DoubleBinding.get(DoubleBinding.java:203)
    at javafx.beans.property.DoublePropertyBase.get(DoublePropertyBase.java:133)
    at javafx.scene.shape.Rectangle.getWidth(Rectangle.java:235)
    at javafx.scene.shape.Rectangle.toString(Rectangle.java:564)
    at java.lang.String.valueOf(String.java:2985)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at javafx.beans.property.ReadOnlyObjectProperty.toString(ReadOnlyObjectProperty.java:69)
    at java.lang.String.valueOf(String.java:2985)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
...

Original issue reported on code.google.com by jpsacha on 31 Jul 2013 at 2:49

GoogleCodeExporter commented 8 years ago
This same problem also affects the SimpleColorfulCircles demo.

In both demos, the stage is initialized to be an 800x600 rectangle.  Within the 
scene definition, both demos also then create one or more Rectangles using 
their Scene's dimensions, with statements such as:

width <== scene.width
height <== scene.height

Since these statements are used within the Scene's definition, I think its 
possible that the scene has yet to be constructed and, hence, has no values for 
these fields. In turn, this causes JavaFX to recursively search for the value 
until the stack exception occurs.

In any case, the bug can be resolved by storing the stage width and height as 
regular vals, then initializing the corresponding fields to those values, as in 
the attached versions of the demo sources.

Original comment by mike@hindsight-consulting.com on 31 Jul 2013 at 9:37

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by jpsacha on 2 Aug 2013 at 2:45

GoogleCodeExporter commented 8 years ago

Original comment by jpsacha on 27 Aug 2013 at 2:05

GoogleCodeExporter commented 8 years ago

Original comment by jpsacha on 31 Aug 2013 at 2:53