Hi,

There was a frequent crash in PyQgsServerWMS on Travis that I've hopefully 
fixed per 
https://github.com/qgis/QGIS/commit/581d0d30ca89a213b1ba1a56a3fe2af5c896eacd

This is the opportunity to raise attention on the danger of using this pattern:

static SomeClass singletonInstance;

where ~SomeClass() does some non trivial work in its destructor, and in 
particular calling 
other libraries (such as in the above mentionned case). Depending on the order 
into which 
libraries are unloaded and objects destroyed,  ~SomeClass() might call a 
function of a 
library which has already been unloaded, leading to crash.

So I'd suggest rather using a pointer approach (which admitedly makes 
constructing the 
singleton in a thread-safe way a bit harder), and explicitly deleting the 
singleton at 
appropriate and explicit time.

Unless someone is aware of a better approach.

By the way, is there somewhere in the tree a developer guide where we can 
collect such 
knowledge ?

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to