OpenLayers OpenLayers

Ticket #464 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

Overview Map dissappears when on permalinked page

Reported by: openlayers Assigned to: tschaub
Priority: minor Milestone: 2.3 Release
Component: general Version: 2.3 RC1
Keywords: Cc:
State:

Attachments

slice_n_dice.patch (0.7 kB) - added by tschaub on 01/19/07 13:59:54.
patch that clones the listeners array before executing callbacks

Change History

01/10/07 15:43:18 changed by openlayers

01/19/07 13:57:52 changed by tschaub

  • owner set to tschaub.

This is actually a problem with event listener splicing. Patch to follow.

I know that the overview map still isn't updated when you use a permalink, but that's a different ticket. This one just makes sure the control's draw method is called.

01/19/07 13:59:54 changed by tschaub

  • attachment slice_n_dice.patch added.

patch that clones the listeners array before executing callbacks

01/19/07 14:06:32 changed by tschaub

  • keywords set to review.

It is necessary to get a clone of the listeners array when an event is triggered because a callback may manipulate the listeners array before all of the listener functions are called (by unregistering an event). This means that the listeners.length changes during the execution of the for loop - leaving callbacks at the end uncalled. The overview map was listening for a changebaselayer event, but the listener never got called because the arg parser would splice the listener array - removing its own listener, shortening the array length, and leaving the last callback (the overview listener function) uncalled. Cloning the array with a slice() takes care of this.

All (relevant) tests pass in FF, IE, and Opera.

Happy to commit after review.

01/19/07 14:10:56 changed by crschmidt

Wow, that's a nice catch.

Low impact patch. All tests pass (and we definitely test a fair number of event handling situations). Things still appear to work afterwards :) Go ahead to commit, should be pulled up for 2.3.

01/19/07 14:43:17 changed by tschaub

  • keywords changed from review to pullup.

applied at r2164

01/19/07 17:29:02 changed by tschaub

  • version changed from SVN to 2.3 RC1.

01/22/07 22:14:55 changed by crschmidt

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.