Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ListGrid.setFieldProperties() leak on valueMap

$
0
0
Using latest SC 9.1..
When I call listGrid.setFieldProperties(fieldNum, properties) to set valueMap to a field, it goes on to set header button with the same properties as {valueMap: {...}} as in
Code:

ISC_GRIDS.js:setFieldProperties:

    if (this.header != null && this.header.isDrawn()) {
        // getFieldHeader / getLocalFieldNum will account for frozen fields
        var header = this.getFieldHeader(fieldNum),
            headerButton = header.getMember(this.getLocalFieldNum(fieldNum));
        if (headerButton) headerButton.setProperties(properties);
    }

ISC_CORE.js : setProperties() would then try to find a setter (for valueMap) as in
Code:

            if (setter) {
                this[setter](value);
                if (this.propertyChanged) this.propertyChanged(propertyName, value);
            }

Unfortunately, headerButton in this case has a special setValueMap(field, map) defined in ISC_CORE.js:
Code:

//>    @method    dataBoundComponent.setValueMap()
//        Set the valueMap for a field
//
//        @param    fieldID        (number)            number of field to update
//      @param  map        (object)            ValueMap for the field
//
//<
setValueMap : function (field, map) {

    if (!isc.isAn.Object(field)) field = this.getField(field);
    if (!field) return;

    field.valueMap = map;
},

This is not meant to be treated as a normal setter method and it takes TWO parameters. Consequently it adds "valueMap:undefined" to the original valueMap and has thus corrupted it.

The symptom is not obvious on the surface until this valueMap is later processed to iterate for key:value pairs, but none the less this is a case of potential leak and corruption. I've attached a screenshot of stack trace to aid investigation.

Attached Images
File Type: jpg SCLeak.JPG (17.4 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles