Ticket #3650 (new bug)

Opened 13 months ago

Last modified 13 months ago

Custom id on layer skip some initialization

Reported by: gnafu Owned by: euzuro
Priority: minor Milestone: 2.13 Release
Component: Layer Version: 2.11
Keywords: id layer wms Cc:
State: Review

Description

Setting layer id for a WMS layer causes an error. Issue detected 1 year ago, never resolved.  http://comments.gmane.org/gmane.comp.gis.openlayers.user/16912

If the id is passed when creating the layer the code skip the this.events initialization.

Maybe it's a simple typo, a closed brace at the wrong line. Patch attached.

Attachments

layer_id.patch Download (1.1 KB) - added by gnafu 13 months ago.
Patch for ticket #3650

Change History

Changed 13 months ago by gnafu

Patch for ticket #3650

Changed 13 months ago by erilem

I also cannot make sense of the current code, and the attached patch looks good to me. But this sounds suspicious—there must be a reason to the current logic. Does anyone have a clue?

Changed 13 months ago by vmische

Perhaps it helps to know which commit introduced it:  http://trac.osgeo.org/openlayers/changeset/3035

Changed 13 months ago by erilem

Thanks vmische. So this has to do with calling the Layer constructor twice in case of multiple inheritance. But there must be a better way to deal with that. Maybe gnafu's patch + checking if the div was already created.

Note: See TracTickets for help on using tickets.