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 646783 - Accessing DestroyNotify property of generics
Accessing DestroyNotify property of generics
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Generics
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks: 589548
 
 
Reported: 2011-04-05 07:06 UTC by Maciej (Matthew) Piechotka
Modified: 2018-05-22 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2011-04-05 07:06:32 UTC
While the Vala-provided GC is proper way of handling garbage collection it is not always possible. For example reference counting in lock-free data structures requires primitives not-widely avaible such as DCAS.

It means that in some cases other methods are needed to cover such edge cases. Unfortunatly it requires access to destroy notify to properly release resources.
Comment 1 Maciej (Matthew) Piechotka 2011-04-26 09:32:40 UTC
It is possible to do in GObject by:

                DestroyNotify res;
                get ("k-destroy-func", out res);
                return res;

but it seems to be a bit of workaround.
Comment 2 Andre Masella 2013-03-18 00:25:29 UTC
Having syntax to do this could also be useful for compact classes used in certain generics.
Comment 3 Maciej (Matthew) Piechotka 2013-03-18 11:51:40 UTC
(In reply to comment #2)
> Having syntax to do this could also be useful for compact classes used in
> certain generics.

Possibly something like [GenericMethods] proposed in bug #695050 would be better (more automatic) solution to your problem?
Comment 4 Andre Masella 2013-03-18 13:21:12 UTC
I'm not even sure what bug #695050 is proposing. I'd like to be able to go `destructorof(T)` and get back a DestroyNotify that is either the free_function or unref_function as appropriate. In fact, this could be implemented as a macro in C.
Comment 5 GNOME Infrastructure Team 2018-05-22 14:00:00 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/190.