[OpenLayers-Users] Map Destroy Call generating error

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


The problem is more pronounced in ie where if you close the map dialog and
open it again, you will notice a scroll bar and see two maps in the window.

On Wed, Jul 2, 2008 at 10:00 PM, Raj Chundur <rajchundur at gmail.com> wrote:

> 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.idis 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/c54a29a2/attachment.html


More information about the Users mailing list