Ticket #1222 (closed feature: fixed)

Opened 6 years ago

Last modified 5 years ago

IE reports a JS error when refreshing page while drawing a feature

Reported by: elemoine Owned by:
Priority: blocker Milestone: 2.6 Release
Component: Renderer.VML Version: SVN
Keywords: Cc:
State: Complete

Description

Andrew de Klerk reported a problem with IE: we get javascript errors when refreshing the page (F5 or Ctrl+F5) while in the process of drawing a feature.

crschmidt's words for describing the issue:

If you are *currently* in the process of drawing a new feature, and you
refresh the page, then the Map.destroy function which is called on page
onunload loops through the controls and destroys them. The Control calls
the Handler destroy, which calls the handler deactivate() method, which
(in the Point handler) calls the this.cancel() if drawing is true, which
then calls this.layer.renderer.clear()...

... But because the controls are destroyed *after* the layers in the map
destroy() function, the layer has already been destroyed, and it has no
renderer property, which means that IE throws an error.

I can reproduce this in IE7. Someone should file this as a bug, and we
should write a test for it. The test should look like:

 var handler = new OpenLayers.Handler.Point();
 handler.activate();
 handler.layer.destroy();
 handler.deactivate();

Though in a quick test inside Firebug lite, new OpenLayers.Handler()
returns undefined, so I'm probably missing something more important.

This should be a blocker for 2.6.

Attachments

desroy_first.patch Download (1.0 KB) - added by crschmidt 5 years ago.
1222-r6169-A0.patch Download (2.4 KB) - added by ahocevar 5 years ago.
This patch addresses an additional issue with Control.Panel's destroy()

Change History

Changed 5 years ago by crschmidt

Instead of the above solution, I talked to the folks here and we decided that we should just change the order of the Map.destroy() so that controls are destroyed first, which changes this behavior. Attaching patch which does this; needs to be run in IE, since that's the only place errors with destroy would really pop up.

Changed 5 years ago by crschmidt

Changed 5 years ago by crschmidt

  • state set to Review

Changed 5 years ago by ahocevar

This patch addresses an additional issue with Control.Panel's destroy()

Changed 5 years ago by crschmidt

  • state changed from Review to Commit

Looks good, thanks for running the tests in IE< please commit

Changed 5 years ago by ahocevar

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [6172]) Fixed several destroy() methods to avoid running into undefined objects when the page unloads. r=crschmidt,me (closes #1222)

Note: See TracTickets for help on using tickets.