msDrawMap(): Map parent object is null

Tamas Szekeres szekerest at GMAIL.COM
Tue Jun 5 13:15:04 PDT 2007


Rodrigo,

Your analysis was pretty exhaustive :-)

Formery initLayer was responsible to set up the back reference in the
layer object. As of the RFC24 related changes the
initLayer/msCopyLayer were replaced with a simple assignment of the
reference but indeed I cannot see the assignment of the parent
reference a the layer object.

I think Umberto will correct this issue easily.

In the meantime you can try something like this

Index: mapobject.c
===================================================================
--- mapobject.c	(revision 6161)
+++ mapobject.c	(working copy)
@@ -472,6 +472,7 @@
         //msCopyLayer((GET_LAYER(map, nIndex)), layer);
 	GET_LAYER(map, nIndex)=layer;
         GET_LAYER(map, nIndex)->index = nIndex;
+        layer->map = map;

         /* adjust layers drawing order */
         for (i=map->numlayers; i>nIndex; i--) {


Best regards,

Tamas


2007/6/5, Rodrigo Del C. Andrade <rodrigo.andrade at digitro.com.br>:
>     Hello dear list, I wish it had been a longer while before I had to
> bother y'all again, but I am pulling my hairs out on this one.
>
>     <deepBreath>
>     Here it goes: using java mapscript rev 6168 from svn, whenever I try
> to activate a specific layer, I get this:
>
>     msDrawMap(): Image handling error. Failed to draw layer named
> 'Layer_Tematica_RJ_145'.;: The map parent object is null.
>     Tomcat does not crash, so I think this could be a good sign.
>
>     Digging trough mapserver code I was unable to find this message and
> look at its context to get a better idea of whats going on, so debuging
> my code step by step I came up with the following facts:
>
>     1- the layer where it crashes is the 68th in the line. Previously
> layers where drawn, both inline and non-inline ones.
>     2 - this layer is a clone from a layer that exists in the mapfile.
> It is declared with:
>
>                 layerObj layer =
> map.getLayerByName(nameFromConstant).cloneLayer();
>                layer.setName("blahblahblah");
>                try{
>                     valores = mapa.insertLayer(layerValores, -1);
>                 }catch(Exception e){
>                     throw new DGTKeyException("error.maxNumLayers",
> e.getMessage());
>                }
>
>     3 - It only crashes when this layer is turned on. Map is shown with
> this layer off when user first logs and it can be turned on from a tree
> widget. If he does, boom.
>     4 - Just before calling map.draw(), both map.getLayerByName(name)
> and map.getLayer(index) return the right layer. whem map.draw() is
> called, boom.
>     5 - Suspecting of the clonage bits mixed with the changes to object
> parenthood Umberto implemented, I modified make threadtests to clone a
> bunch of layers, insert them into the map, juggle them around a bit like
> happens in my app and then call map.draw() in the hopes of reproducing
> the error. No go. The test works normally and no errors occur. :(
>     and finally 6 - reverting to mapserver 4.10.1 "fixes" it.
>
>     Any clues?
>
>     Thanks!
>
>     Rodrigo
>
>
>
> --
> *Rodrigo Del C. Andrade*
> /Programador/
> /SIC - SSE - Soluções Segurança Pública/
>
> *DÍGITRO TECNOLOGIA*
> *E-mail:* rodrigo.andrade at digitro.com.br
> <mailto:rodrigo.andrade at digitro.com.br>
> *Fone:* +55 48 3281-7314 / +55 48 3281-7000
> *Fax:* +55 48 3281-7299
> *Site:* www.digitro.com <http://www.digitro.com>
>



More information about the MapServer-users mailing list