After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699550 - Fix thread-safety issues with base_init() when registering an interface
Fix thread-safety issues with base_init() when registering an interface
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GObject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-05-03 06:11 UTC by Stef Walter
Modified: 2018-05-17 11:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use default_init instead of base_init when registering interfaces (3.68 KB, patch)
2013-05-03 06:12 UTC, Stef Walter
committed Details | Review
A simple test case for looking over the changes (457 bytes, text/plain)
2013-05-03 06:12 UTC, Stef Walter
  Details

Description Stef Walter 2013-05-03 06:11:48 UTC
We should use default_init instead of base_init when registering interfaces
    
Using base_init() is overly complex, requires multi-initialization
guards, and in the case of vala generated code these are currently
not thread safe.
    
The recommended approach is to use default_init() to initialize
interfaces. It is called only once, solves thread safety issues.

The GObject tutorial was incorrect for many years in recommending 
base_init() but that has since been remedied.

https://developer.gnome.org/gobject/stable/gtype-non-instantiable-classed.html#gtype-non-instantiable-classed-init

https://developer.gnome.org/gobject/stable/howto-interface.html#howto-interface-define
Comment 1 Stef Walter 2013-05-03 06:12:04 UTC
Created attachment 243139 [details] [review]
Use default_init instead of base_init when registering interfaces

Using base_init() is overly complex, requires multi-initialization
guards, and in the case of vala generated code these are currently
not thread safe.

The recommended approach is to use default_init() to initialize
interfaces. It is called only once, solves thread safety issues.
Comment 2 Stef Walter 2013-05-03 06:12:40 UTC
Created attachment 243140 [details]
A simple test case for looking over the changes
Comment 3 Rico Tzschichholz 2018-05-17 11:36:02 UTC
Attachment 243139 [details] pushed as 71f779e - Use default_init instead of base_init when registering interfaces