[vala/0.34] codegen: Only add _error path if there's parameters that require unref



commit b4fd34897fecb8756e401c753c1d3140ed30cced
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Mar 6 11:40:24 2017 +0100

    codegen: Only add _error path if there's parameters that require unref
    
    Fixes the _error label from being set at the end of a compound statement
    if there are no values to unref.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778540

 codegen/valagdbusservermodule.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index 8f74aad..ff1b236 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -145,8 +145,12 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        return_error.add_argument (new CCodeIdentifier ("error"));
                                        ccode.add_expression (return_error);
 
-                                       ccode.add_goto ("_error");
-                                       need_goto_label = true;
+                                       if (need_goto_label || requires_destroy (owned_type)) {
+                                               ccode.add_goto ("_error");
+                                               need_goto_label = true;
+                                       } else {
+                                               ccode.add_return ();
+                                       }
 
                                        ccode.close ();
                                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]