[OpenLayers-Users] Map Destroy Call generating error

Raj Chundur rajchundur at gmail.com
Wed Jul 2 22:00:02 EDT 2008


Eric, Fellow Users
Thanks for the info. I have posted the barebones of the application as an
example at
http://cagismaps.hamilton-co.org/CWCC_APP/CWCC_launch.html
Note: Firefox displays error better than ie.

The app loads openlayers in a map dialog window. The user may close and open
this map multiple times. So to ensure all Javascript objects are cleaned out
I call the map.destroy when the map dialog is closed.
I get the error Type Error:element is null.

I am able to trace the error down from map.destroy (in map.js)  to
layer.destroy (in layer.js) for each kamap layer i have added to
image.destroy (in tile.js) where the call
OpenLayers.Event.stopObservingElement(this.imgDiv.id); is causing the error.
Looking at the code in stopObservingElement It seems that this.imgDiv.id is
not resulting in an object in the call
var element = OpenLayers.Util.getElement(elementParam);
the error is resulting from element being null at this stage in the tile
clean up code.

Appreciate any help in this regard.

RC

On Tue, Jun 24, 2008 at 6:07 PM, Eric Lemoine <eric.c2c at gmail.com> wrote:

> On Wed, Jun 11, 2008 at 6:53 AM, Raj Chundur <rajchundur at gmail.com> wrote:
> > I have incorporated openlayers in a rich internet application with the
> map
> > inside a dialog window that can be opened and closed without page
> refresh.I
> > have been getting some heavy memory leaks even though I had dereferenced
> the
> > openayers map object. In order to avoid memory leak and ensure that the
> > openlayers map is destroyed when the dialog hosting the openlayers map is
> > closed i tried calling the map.destroy. However the call to map.destroy
> > fails at two places. One is on the overview map which has a single layer
> of
> > type openlayers.layer.image. So removed the overview conrol. The second
> is
> > on  a tiled kamap layer though other kamap layers are destroyed without
> > error. (The base layer is of type openlayers.layer.iamge type)) Trying to
> > debug leads upto the clear grid on the httprequest..js where the error
> > happens with "element has no property". Have spent considerable time
> trying
> > to figure out the cause. Any help?
>
> Hi Raj, with no example showing the problem it's very unlikely that
> you get assistance on the mailing list. Regards,
>
> --
> Eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080702/d501cdae/attachment.html


More information about the Users mailing list