]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Only add _error path if there's parameters that require unref
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 6 Mar 2017 10:40:24 +0000 (11:40 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 6 Mar 2017 13:16:08 +0000 (14:16 +0100)
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

index 4f06210f7932110fbcdc6aeeb6d4edd2954a29f5..2cb42710ed2f842e505bece6e0051735ac32f0e9 100644 (file)
@@ -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 ();
                                }