GNOME Bugzilla – Bug 779034
Replace GStaticPrivate with GPrivate
Last modified: 2018-05-22 15:45:06 UTC
Created attachment 346391 [details] [review] Replace GStaticPrivate with GPrivate GStaticPrivate is deprecated so GPrivate should be used.
I guess you want to avoid the deprecation warning, but g_private_new is deprecated too.
Is it glib VAPI wrong then? May I'm wrong but don't find any other way to create a Private structure. VAPI in master is: [Compact] [CCode (ref_function = "", unref_function = "")] public class Private { public Private (DestroyNotify? destroy_func = null); public void* get (); public void set (void* data); public void replace (void* data); }
The VAPI is not wrong, just incomplete.
Created attachment 346421 [details] [review] Use GLib.Private instead of GLib.StaticPrivate Bind Private as struct instead of compact-class
My approach removes functionality and should not be merged for 0.36. I can't find a better way though.
Review of attachment 346421 [details] [review]: Why should be delayed, this API break should be in place or we will see lot of bug report about warnings/bindings. 0.34 is not released yet, we should tackle as short as possible. Your bindins use void* but should be generic instead? [Version (since = "2.32")] [CCode (has_copy_function = false, has_destroy_function = false, lvalue_access = false, default_value = "G_PRIVATE_INIT (NULL)")] public struct Private<G> { public G get (); public void set (G data); public void replace (G data);
Seeking at GLib documentation at: https://developer.gnome.org/glib/stable/glib-Threads.html#G-PRIVATE-INIT:CAPS It seems we need some stuff to implement G_PRIVATE_INIT and check if we will need to pass a GDestroyNotify method in order to free data according with its type.
*** Bug 761310 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/578.