Closed tuntematonjr closed 6 years ago
Don't feel bad. You're making the program better. :)
I figured out how to replicate:
Order of events:
The source of the problem is that the property's value editor isn't anticipating the PropertyType
to change and the editor only edits one PropertyType
. For example, the ColorArrayEditor
only expects SVColorArray
(PropertyType.Color
) and results in a ClassCastException because it is casting the ControlProperty's value to SVColorArray, despite it being something else.
Code creating the exception:
// In SVColorArrayEditor.controlPropertyListener.valueUpdated()
setValue(((SVColorArray) controlProperty.getValue()));
What needs to happen is when a ControlProperty
's value is updated but the type is changed, the current editor's value listeners attached to the updated ControlProperty
should be disabled prior to the Value Update event. Then the editor won't create an exception. After the value has been set and the inheritance related events have occured, the ControlPropertyEditorContainer
should reset the current editor so that it shows the relevant editor and the listeners are re-enabled.
The fix was creating an event notifying the ControlProperty
's listeners that it is inheriting another ControlProperty
(named PreemptiveControlPropertyInheritUpdate
). This new event takes place before the old inherit update and the value update. Then the editor listens for the PreemptiveControlPropertyInheritUpdate
and clears the listeners for the editor. Then when the old inherit update occurs, the editor becomes reset.
fix applied in version 1.0.3
Version and Build
1.0.2
Summary
Making control class and choosing parrent class for it cause internal error. https://i.gyazo.com/e4553bef94a816b457a05e59688df797.png Im starting feel bad making these bug reports =D I'm doing stupid things that nobody should do or what =)
Detail
https://pastebin.com/b8dy7shs