GNOME Bugzilla – Bug 686337
Static data is not initialized until instance of class is created
Last modified: 2012-10-19 19:11:48 UTC
Static data is not initialized until instance of class is created which is usually contrary to behaviour of most languages when the data is initialized before calling. Proposed solutions: 1. _get_type function performs part of initialization. If it was inlinable and if marked as G_UNLIKELY calling it would be a nearly no-op (just one pointer-size atomic get + compatation). This could be done either for all functions or just on by default. 2. Create custom GOnce per static region (similar to 1. but does not enforce the initialization during typeof(X) calls) 3. Put static members to Class structure and enforce getting them in this way (probably the most heavyweight solution in terms of performance).
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 543189 ***