sivarajankumar / screen3d

Automatically exported from code.google.com/p/screen3d
0 stars 0 forks source link

[SCREEN/UTILS] Singleton pattern crash on linux #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Crash if another singleton than the Logger and the Profiler are initialized 
first

It's due to the static variable fiasco :

http://cpp.developpez.com/faq/cpp/?page=static#CONSTRUCTEUR_static_fiasco

Original issue reported on code.google.com by thoratou@gmail.com on 7 Jun 2010 at 11:46

GoogleCodeExporter commented 8 years ago
Development started.

Implementation based on lazy instantiation of singleton and ordered destruction

The implementation is based on the assumption that if a singleton 1 uses a 
singleton 
2 in his constructor, or if the 2 is used before the 1, the 2 doesn't use the 1 
in 
his destructor.

In practice, the Logger and the Profiler (that must be used before everyone) 
are the 
only singletons used by other singletons. So, for now, the assumption is 
verified.

In order to avoid this assumption in the future, the singleton pattern must 
implement "singleton destruction order levels" ("last" for Logger and Profiler, 
...)

Original comment by thoratou@gmail.com on 7 Jun 2010 at 11:58

GoogleCodeExporter commented 8 years ago
Bug fixed in Screen/Utils

Original comment by tt.tranq...@gmail.com on 12 Jun 2010 at 6:33

GoogleCodeExporter commented 8 years ago
fix validated

Original comment by thoratou@gmail.com on 23 Jun 2010 at 9:11