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 683600 - leaking owned delegate in async
leaking owned delegate in async
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other Linux
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-07 23:38 UTC by Marc-Andre Lureau
Modified: 2012-09-08 05:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marc-Andre Lureau 2012-09-07 23:38:59 UTC
Boxes suffers annoying leakings since we turned the RunInThreadFunc delegate argument to owned in the following commit

http://git.gnome.org/browse/gnome-boxes/commit/?id=d3c7a347ff419a787fc84d2b1529d620c5f0b335

looking at simplified generated code from:

public delegate void RunInThreadFunc () throws  GLib.Error;
public async void run_in_thread (owned RunInThreadFunc func) {
    /* some code */
}

void run_in_thread (RunInThreadFunc func, void* func_target, GDestroyNotify func_target_destroy_notify, GAsyncReadyCallback _callback_, gpointer _user_data_) {
        RunInThreadData* _data_;
        RunInThreadFunc _tmp0_;
        void* _tmp0__target;
        _data_ = g_slice_new0 (RunInThreadData);
        _data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, run_in_thread);
        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, run_in_thread_data_free);
        _tmp0_ = func;
        _tmp0__target = func_target;
        (_data_->func_target_destroy_notify == NULL) ? NULL : (_data_->func_target_destroy_notify (_data_->func_target), NULL);
        _data_->func = NULL;
        _data_->func_target = NULL;
        _data_->func_target_destroy_notify = NULL;
        _data_->func = _tmp0_;
        _data_->func_target = _tmp0__target;
        _data_->func_target_destroy_notify = NULL;
        run_in_thread_co (_data_);
}


It seems func_target_destroy_notify is never called.
Comment 1 Jürg Billeter 2012-09-08 05:43:42 UTC
commit 590dd689b90909f7ed27c097a7014f7a8cba8dcf
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Sep 8 07:20:42 2012 +0200

    codegen: Fix memory leak with owned delegate parameters in async methods
    
    Fixes bug 683600.