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 779034 - Replace GStaticPrivate with GPrivate
Replace GStaticPrivate with GPrivate
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: general
unspecified
Other Linux
: Normal minor
: 1.0
Assigned To: Rico Tzschichholz
Vala maintainers
: 761310 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-02-21 19:52 UTC by Daniel Espinosa
Modified: 2018-05-22 15:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace GStaticPrivate with GPrivate (1.08 KB, patch)
2017-02-21 19:52 UTC, Daniel Espinosa
none Details | Review
Use GLib.Private instead of GLib.StaticPrivate (1.83 KB, patch)
2017-02-22 08:47 UTC, Rico Tzschichholz
reviewed Details | Review

Description Daniel Espinosa 2017-02-21 19:52:21 UTC
Created attachment 346391 [details] [review]
Replace GStaticPrivate with GPrivate

GStaticPrivate is deprecated so GPrivate should be used.
Comment 1 Rico Tzschichholz 2017-02-21 22:10:30 UTC
I guess you want to avoid the deprecation warning, but g_private_new is deprecated too.
Comment 2 Daniel Espinosa 2017-02-22 06:18:39 UTC
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);
}
Comment 3 Rico Tzschichholz 2017-02-22 07:26:13 UTC
The VAPI is not wrong, just incomplete.
Comment 4 Rico Tzschichholz 2017-02-22 08:47:16 UTC
Created attachment 346421 [details] [review]
Use GLib.Private instead of GLib.StaticPrivate

Bind Private as struct instead of compact-class
Comment 5 Rico Tzschichholz 2017-02-22 08:50:23 UTC
My approach removes functionality and should not be merged for 0.36.
I can't find a better way though.
Comment 6 Daniel Espinosa 2017-02-22 13:38:25 UTC
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);
Comment 7 Daniel Espinosa 2017-02-22 16:13:00 UTC
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.
Comment 8 Rico Tzschichholz 2017-03-09 09:10:20 UTC
*** Bug 761310 has been marked as a duplicate of this bug. ***
Comment 9 GNOME Infrastructure Team 2018-05-22 15:45:06 UTC
-- 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.