[fix] Adds duplicate guard when add a 'ComponentChangeListener' to the rocket
This commit is contained in:
parent
58eb9fff90
commit
644404b070
@ -413,7 +413,9 @@ public class Rocket extends ComponentAssembly {
|
|||||||
@Override
|
@Override
|
||||||
public void addComponentChangeListener(ComponentChangeListener l) {
|
public void addComponentChangeListener(ComponentChangeListener l) {
|
||||||
checkState();
|
checkState();
|
||||||
listenerList.add(l);
|
if( ! listenerList.contains(l)) {
|
||||||
|
listenerList.add(l);
|
||||||
|
}
|
||||||
log.trace("Added ComponentChangeListener " + l + ", current number of listeners is " +
|
log.trace("Added ComponentChangeListener " + l + ", current number of listeners is " +
|
||||||
listenerList.size());
|
listenerList.size());
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,6 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
|
|||||||
* @param component Component to configure.
|
* @param component Component to configure.
|
||||||
*/
|
*/
|
||||||
private void setComponent(OpenRocketDocument document, RocketComponent component) {
|
private void setComponent(OpenRocketDocument document, RocketComponent component) {
|
||||||
if (this.document != null) {
|
|
||||||
this.document.getRocket().removeComponentChangeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configurator != null) {
|
if (configurator != null) {
|
||||||
// Remove listeners by setting all applicable models to null
|
// Remove listeners by setting all applicable models to null
|
||||||
GUIUtil.setNullModels(configurator); // null-safe
|
GUIUtil.setNullModels(configurator); // null-safe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user