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 641171 - Uncaught errors leak async_result for GIO style APIs
Uncaught errors leak async_result for GIO style APIs
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Errors
0.11.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-02-01 17:37 UTC by Philip Van Hoof
Modified: 2017-04-30 16:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Excerpt of the generated .c file, from tracker-bus.vala (7.98 KB, text/plain)
2011-02-01 17:37 UTC, Philip Van Hoof
  Details
codegen: Unref GLib.AsyncResult on uncaught errors in coroutines (1.23 KB, patch)
2017-04-28 13:41 UTC, Rico Tzschichholz
committed Details | Review

Description Philip Van Hoof 2011-02-01 17:37:03 UTC
When using this .vala file:

http://git.gnome.org/browse/tracker/tree/src/libtracker-bus/tracker-bus.vala

and in particular looking at the generated function tracker_bus_connection_real_query_async_co, we notice that in the uncaught error else-block data->_async_result isn't unreffed like in the caught error case prior to returning the _co function.

I have attached an excerpt of the generated tracker-bus.c file for investigation purposes.

Vala version used was valac 0.11.4

if (data->_inner_error_ != NULL) {
	if (((data->_inner_error_->domain == TRACKER_SPARQL_ERROR) || (data->_inner_error_->domain == G_IO_ERROR)) || (data->_inner_error_->domain == G_DBUS_ERROR)) {
		g_simple_async_result_set_from_error (data->_async_result, data->_inner_error_);
		g_error_free (data->_inner_error_);
		_g_object_unref0 (data->output);
		_g_object_unref0 (data->input);
		block2_data_unref (data->_data2_);
		if (data->_state_ == 0) {
			g_simple_async_result_complete_in_idle (data->_async_result);
		} else {
			g_simple_async_result_complete (data->_async_result);
		}
		g_object_unref (data->_async_result);
		return FALSE;
	} else {
		_g_object_unref0 (data->output);
		_g_object_unref0 (data->input);
		block2_data_unref (data->_data2_);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
		g_clear_error (&data->_inner_error_);
		return FALSE;
	}
}
Comment 1 Philip Van Hoof 2011-02-01 17:37:46 UTC
Created attachment 179814 [details]
Excerpt of the generated .c file, from tracker-bus.vala
Comment 2 Rico Tzschichholz 2017-04-28 13:41:16 UTC
Created attachment 350644 [details] [review]
codegen: Unref GLib.AsyncResult on uncaught errors in coroutines

Ignoring the warning of uncaught error in async methods resulted in
leaking a reference to the scopes GLib.AsyncResult.
Comment 3 Rico Tzschichholz 2017-04-30 16:30:40 UTC
Attachment 350644 [details] pushed as 39f3472 - codegen: Unref GLib.AsyncResult on uncaught errors in coroutines