[postgis-users] msPOSTGISLayerCLose() called twice

Daniel Morissette morissette at dmsolutions.ca
Wed Aug 13 06:52:51 PDT 2003


Jan Hartmann wrote:
> 
> msPOSTGISLayerClose() *does* get called twice: once in msLayerClose() 
> (maplayer.c), and once in closeConnections() (mapfile.c). The second one 
> is in the connection pool code I added in January, the first one is in 
> the original layer-by-layer code. In fact, the second one should only be 
> called after the pooling code has been added for PostGIS. I remember 
> having discussed this with Steve Lime (i.e. synchronizing pooling and 
> non-pooling database code), but this seems to have slipped through. I am 
> not sure if closing an already closed layer will hurt (it does not seem 
> to have broken up anything until now), but if you want to be sure, 
> either remove the call in mapfile.c, or add the pooling code in 
> mappostgis.c.
> 

I don't think it's right for the pooling code to call close a second 
time, but it wouldn't hurt anyway to modify msPOSTGISLayerClose() to 
check if the layer is still open before closing it.  From MapScript it's 
possible for a script to call $layer->close() twice, a mistake that will 
be very common in scripts I'm sure, so it would be better if calling 
close twice didn't crash the server but instead either returned silently 
or produced an error.

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               morissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------




More information about the postgis-users mailing list