[vala/wip/gtask: 19/21] async: NULL check for cancelled GTasks
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/gtask: 19/21] async: NULL check for cancelled GTasks
- Date: Tue, 25 Oct 2016 09:16:41 +0000 (UTC)
commit 5166a46e99bf850fbc350fd7eec454d2615a4e75
Author: Ben Iofel <iofelben gmail com>
Date: Wed Apr 27 18:35:02 2016 -0400
async: NULL check for cancelled GTasks
https://bugzilla.gnome.org/show_bug.cgi?id=763345
codegen/valagasyncmodule.vala | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 99e17ff..527e1f5 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -570,7 +570,17 @@ public class Vala.GAsyncModule : GtkModule {
ccode.add_assignment (data_var, ccall);
- if (m.get_error_types ().size > 0) {
+ bool has_cancellable = false;
+
+ foreach (Parameter param in m.get_parameters ()) {
+ if (param.variable_type is ObjectType &&
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
+ has_cancellable = true;
+ break;
+ }
+ }
+
+ // If a task is cancelled, g_task_propagate_pointer returns NULL
+ if (m.get_error_types ().size > 0 || has_cancellable) {
var is_null = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new
CCodeConstant ("NULL"), data_var);
ccode.open_if (is_null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]