OpenLayers OpenLayers

Ticket #549 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

Map's destroy should clear out the map div all the elements it created

Reported by: euzuro Assigned to: euzuro
Priority: critical Milestone: 2.4 Release
Component: Map Version: SVN
Keywords: Cc:
State:

Description

I found this as a bug because in Opera, running tests, I noticed that if i made several different tests, each of them calling:

   var map = new OpenLayers.Map("map");

then each time the map div was getting extra stuff put in it (namely the layercontainer divs). this was causing the updateSize() function to think that the map div was actually bigger than it really should have been (and getting progressively bigger with each new instantiation).

By calling map.destroy() and having map.destroy actually clear out that div, we avoid this problem.

Attachments

clearMapDiv.patch (5.1 kB) - added by euzuro on 03/21/07 14:54:21.
this patch clears the div on map destroy, adds a test for that to the map test, and adds calls to map.destroy() in some test files to help them pass correctly in Opera. according to my tests, this fixes the markers and overviewmap tests in opera, though the wms test is still failing mysteriously.
destroy.patch (1.0 kB) - added by euzuro on 03/22/07 15:44:33.
this patch fixes the horror caused by the previous patch. apologies for doing something so silly.
unloadDestroy.patch (1.5 kB) - added by euzuro on 03/23/07 13:40:28.
this patch fixes the double-destroy problem by unregistering the call to destroy on the windows unload from within the map's destory method.

Change History

03/21/07 14:54:21 changed by euzuro

  • attachment clearMapDiv.patch added.

this patch clears the div on map destroy, adds a test for that to the map test, and adds calls to map.destroy() in some test files to help them pass correctly in Opera. according to my tests, this fixes the markers and overviewmap tests in opera, though the wms test is still failing mysteriously.

03/21/07 14:54:51 changed by euzuro

  • keywords set to review.

03/21/07 15:01:50 changed by sderle

  • keywords changed from review to accepted.

this patch looks fine. please commit.

03/22/07 08:23:36 changed by sderle

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

applied by euzuro as r2836.

03/22/07 15:43:42 changed by euzuro

  • status changed from closed to reopened.
  • resolution deleted.

this was a lousy patch. instead of just blowing everything away with a dull eraser (innerHTML = "") we should remove the things we've added.

This patch is causing serious errors in the test files, due to multiple OpenLayers.Map instantiations on a single Div.

03/22/07 15:44:33 changed by euzuro

  • attachment destroy.patch added.

this patch fixes the horror caused by the previous patch. apologies for doing something so silly.

03/22/07 15:46:48 changed by sderle

I approve!

03/22/07 15:48:06 changed by euzuro

  • status changed from reopened to closed.
  • resolution set to fixed.

fixed with r2858

03/23/07 13:39:46 changed by euzuro

  • status changed from closed to reopened.
  • resolution deleted.

if user calls map.destroy on his own, then unloads the page, we have a double destroy situation. not good.

03/23/07 13:40:28 changed by euzuro

  • attachment unloadDestroy.patch added.

this patch fixes the double-destroy problem by unregistering the call to destroy on the windows unload from within the map's destory method.

03/23/07 13:44:04 changed by euzuro

  • keywords changed from accepted to review.

03/23/07 14:03:17 changed by sderle

  • keywords changed from review to commit.
  • owner set to euzuro.
  • status changed from reopened to new.

unloadDestroy patch looks good. please commit.

03/23/07 21:38:04 changed by euzuro

  • keywords deleted.

unloadDestroy.patch applied with r2874

03/23/07 21:38:33 changed by euzuro

  • keywords set to review.

03/23/07 22:39:13 changed by euzuro

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