GNOME Bugzilla – Bug 683600
leaking owned delegate in async
Last modified: 2012-09-08 05:43:42 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.
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.