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 659619 - Allow copyable delegates
Allow copyable delegates
Status: RESOLVED DUPLICATE of bug 632853
Product: vala
Classification: Core
Component: Delegates
0.18.x
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks: 696979 699973
 
 
Reported: 2011-09-20 16:36 UTC by Maciej (Matthew) Piechotka
Modified: 2014-06-29 08:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2011-09-20 16:36:27 UTC
Copyable delegates correspond to 4 elements instead of 3 (as normal delegates), 2 (unowned delegates)  or 1 (delegates without target):

 - delegate itself
 - target
 - target copy
 - target destroy

In this way the delegate can be safely shared. The lambda blocks can be reference counted for such delegates.
Comment 1 Luca Bruno 2011-09-20 17:43:19 UTC
This will never be the case, just wrap it in a class or use GClosure (which needs some work). The fact that we current use delegate+target+destroy is an unfortunate implementation due to mapping to existing C libraries.
Comment 2 Maciej (Matthew) Piechotka 2011-09-20 17:48:44 UTC
(In reply to comment #1)
> This will never be the case, just wrap it in a class or use GClosure (which
> needs some work). The fact that we current use delegate+target+destroy is an
> unfortunate implementation due to mapping to existing C libraries.

Is there any documentation regarding using GClosure and vala?
Comment 3 Maciej (Matthew) Piechotka 2011-09-20 17:49:45 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > This will never be the case, just wrap it in a class or use GClosure (which
> > needs some work). The fact that we current use delegate+target+destroy is an
> > unfortunate implementation due to mapping to existing C libraries.
> 
> Is there any documentation regarding using GClosure and vala?

Ups. Missing "(unless you mean direct interface to C)".
Comment 4 Adam Stark 2012-07-31 19:10:50 UTC
*** Bug 680931 has been marked as a duplicate of this bug. ***
Comment 5 Maciej (Matthew) Piechotka 2012-09-27 02:04:13 UTC
Marking for 0.10.

Proposed syntaxt:

      [Closure]
      public delegate void Closure(void);
      
      Closure c  = ...
Comment 6 Luca Bruno 2013-04-01 11:30:48 UTC
The GClosure thing must be per-parameter, not per-delegate.
Comment 7 Evan Nemerson 2014-06-29 07:31:56 UTC
Duplicate of bug #632853?
Comment 8 Luca Bruno 2014-06-29 08:55:18 UTC
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 632853 ***