Skip to content

Commit

Permalink
Fixes a null object exception on FootPrintComboBox.
Browse files Browse the repository at this point in the history
The listeners are not automatically removed from the store and since the
store has a much longer lifetime, the event is fired and tries to call
an dangling reference to this class.

There are more such things pending in the project due to code duplication
artifacts which should be omitted.
  • Loading branch information
Sven Steckmann committed Feb 9, 2013
1 parent d8df275 commit 45a495a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/frontend/js/Components/Widgets/FootprintComboBox.js
Expand Up @@ -11,15 +11,15 @@ Ext.define("PartKeepr.FootprintComboBox",{
initComponent: function () {
this.store = PartKeepr.getApplication().getFootprintStore();

/* Workaround to remember the value when loading */
this.store.on("beforeload", function () {
this._oldValue = this.getValue();
}, this);
this.listenersStore = this.store.mon({
item: this,
scope: this,
// Workaround to remember the value when loading
beforeload: function () { this._oldValue = this.getValue(); },
// Set the old value when load is complete
load: function () { this.setValue(this._oldValue); }
});

/* Set the old value when load is complete */
this.store.on("load", function () {
this.setValue(this._oldValue);
}, this);

this.callParent();
}
Expand Down

0 comments on commit 45a495a

Please sign in to comment.