[mapserver-dev] Crash on Windows: fontcache.c

Even Rouault even.rouault at spatialys.com
Sun Oct 19 13:01:31 PDT 2014


> 
> Even that did it!  (I removed the second call, the 3 lines, for
> msCleanupOnExit, as you said).   Wow!  Thank you so much.  Will you
> commit this into master now?  I can also, but, you solved it.
> 
> I can also file a ticket if you want this to be recorded.  Let me know.

I could commit, but perhaps Thomas should confirm. It is somehow linked to his 
commit 
https://github.com/mapserver/mapserver/commit/18b51c4a36e6447793a48744f64adcb7c20585e2 
that added msFontCacheCleanup() in msCleanup(). Although that the double 
cleanup on Windows is probably much older than that.

I think that msFontCacheCleanup() doesn't like to be called twice in the 
ifndef USE_THREAD case (I suspect you compile without USE_THREAD since I think 
the other code path can be safely called twice)

From the comment at line 227 of mapserv.c before
#ifdef WIN32
  atexit( msCleanupOnExit );
#endif
I'm wondering if the intent wasn't that this code should be called when the 
process is stopped in a brutal way (on unix there is similar code above based 
on signal handlers). But I'm quite surprised that atexit() is called in non-
nominal process end. According to the man page of atexit() : "Functions 
registered using atexit() (and on_exit(3)) are not called if a process 
terminates abnormally because of the delivery of a signal."
And it seems that Windows follows POSIX behaviour since according to 
http://msdn.microsoft.com/en-us/library/tze57ck3.aspx "The atexit function is 
passed the address of a function (func) to be called when the program 
terminates normally."

> 
> I owe you a beer.

Next time you come by Paris ;-)

> 
> -jeff
> 
> 
> 
> 
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the mapserver-dev mailing list