Hi Even > On 16 Nov 2017, at 00:58, Even Rouault <[email protected]> wrote: > > Hi, > > There was a frequent crash in PyQgsServerWMS on Travis that I've hopefully > fixed per > https://github.com/qgis/QGIS/commit/581d0d30ca89a213b1ba1a56a3fe2af5c896eacd > <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 ?
We have: https://www.qgis.org/en/site/getinvolved/development/qgisdevelopersguide/index.html Source for which is here: There is a ‘fix me’ link in the bottom of each page in the guide which will take you to the sphinx sources. Regards Tim > > Even > > -- > Spatialys - Geospatial professional services > http://www.spatialys.com > <http://www.spatialys.com/>_______________________________________________ > QGIS-Developer mailing list > [email protected] <mailto:[email protected]> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > <https://lists.osgeo.org/mailman/listinfo/qgis-developer> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > <https://lists.osgeo.org/mailman/listinfo/qgis-developer> — Tim Sutton Co-founder: Kartoza Project chair: QGIS.org Visit http://kartoza.com <http://kartoza.com/> to find out about open source: Desktop GIS programming services Geospatial web development GIS Training Consulting Services Skype: timlinux IRC: timlinux on #qgis at freenode.net
_______________________________________________ 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
