[vala/staging] gdbus: Use g_dbus_method_invocation_take_error() as simplification



commit 6d6190135b9afcee409232a96dc2123698316797
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 10 15:35:53 2021 +0100

    gdbus: Use g_dbus_method_invocation_take_error() as simplification

 codegen/valagdbusservermodule.vala                 | 12 ++--------
 tests/dbus/arrays_client.c-expected                |  6 ++---
 tests/dbus/async-bus_client.c-expected             |  3 +--
 tests/dbus/async-bus_server.c-expected             |  3 +--
 tests/dbus/async-connection_client.c-expected      |  3 +--
 tests/dbus/async-connection_server.c-expected      |  3 +--
 tests/dbus/async-errors_client.c-expected          | 12 ++++------
 tests/dbus/async-errors_server.c-expected          | 12 ++++------
 tests/dbus/async-no-reply_client.c-expected        |  6 ++---
 tests/dbus/async_client.c-expected                 |  9 +++-----
 tests/dbus/basic-types_client.c-expected           |  9 +++-----
 tests/dbus/bug602003_client.c-expected             |  3 +--
 tests/dbus/bug735437_client.c-expected             |  9 +++-----
 tests/dbus/bug782719_client.c-expected             |  3 +--
 tests/dbus/bug783002_client.c-expected             |  3 +--
 tests/dbus/bug783002_server.c-expected             |  3 +--
 tests/dbus/bug792277.c-expected                    | 12 ++++------
 tests/dbus/connection_client.c-expected            |  3 +--
 tests/dbus/connection_server.c-expected            |  3 +--
 tests/dbus/dicts_client.c-expected                 |  3 +--
 tests/dbus/dicts_server.c-expected                 |  3 +--
 tests/dbus/dynamic-method_server.c-expected        |  3 +--
 tests/dbus/enum-string-marshalling.c-expected      | 27 ++++++++--------------
 tests/dbus/errors_client.c-expected                | 15 ++++--------
 tests/dbus/errors_server.c-expected                | 15 ++++--------
 tests/dbus/filedescriptor-async_client.c-expected  |  6 ++---
 tests/dbus/filedescriptor-async_server.c-expected  |  6 ++---
 tests/dbus/filedescriptor-errors_client.c-expected |  6 ++---
 tests/dbus/filedescriptor-errors_server.c-expected |  6 ++---
 tests/dbus/filedescriptor_client.c-expected        |  6 ++---
 tests/dbus/filedescriptor_server.c-expected        |  6 ++---
 tests/dbus/generics_client.c-expected              |  3 +--
 tests/dbus/generics_server.c-expected              |  3 +--
 tests/dbus/no-reply_client.c-expected              |  6 ++---
 tests/dbus/rawvariants_client.c-expected           |  6 ++---
 tests/dbus/signals_client.c-expected               |  6 ++---
 tests/dbus/signals_server.c-expected               |  6 ++---
 tests/dbus/structs_client.c-expected               |  3 +--
 38 files changed, 82 insertions(+), 170 deletions(-)
---
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index e6f379c9f..6e026b43b 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -176,15 +176,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                                        ccode.open_if (new CCodeIdentifier ("error"));
 
-                                       var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_return_gerror"));
+                                       var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_take_error"));
                                        return_error.add_argument (new CCodeIdentifier ("invocation"));
                                        return_error.add_argument (new CCodeIdentifier ("error"));
                                        ccode.add_expression (return_error);
 
-                                       var free_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_error_free"));
-                                       free_error.add_argument (new CCodeIdentifier ("error"));
-                                       ccode.add_expression (free_error);
-
                                        if (need_goto_label || requires_destroy (owned_type)) {
                                                ccode.add_goto ("_error");
                                                need_goto_label = true;
@@ -291,15 +287,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        if (m.tree_can_fail) {
                                ccode.open_if (new CCodeIdentifier ("error"));
 
-                               var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_return_gerror"));
+                               var return_error = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_take_error"));
                                return_error.add_argument (new CCodeIdentifier ("invocation"));
                                return_error.add_argument (new CCodeIdentifier ("error"));
                                ccode.add_expression (return_error);
 
-                               var free_error = new CCodeFunctionCall (new CCodeIdentifier ("g_error_free"));
-                               free_error.add_argument (new CCodeIdentifier ("error"));
-                               ccode.add_expression (free_error);
-
                                if (need_goto_label) {
                                        ccode.add_goto ("_error");
                                } else {
diff --git a/tests/dbus/arrays_client.c-expected b/tests/dbus/arrays_client.c-expected
index 8c17358f0..3ca15671e 100644
--- a/tests/dbus/arrays_client.c-expected
+++ b/tests/dbus/arrays_client.c-expected
@@ -613,8 +613,7 @@ _dbus_test_test_int (Test* self,
        g_variant_unref (_tmp28_);
        result = test_test_int (self, i, i_length1, &j, &j_length1, &result_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -695,8 +694,7 @@ _dbus_test_test_string (Test* self,
        g_variant_unref (_tmp38_);
        result = test_test_string (self, s, s_length1, &t, &t_length1, &result_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-bus_client.c-expected b/tests/dbus/async-bus_client.c-expected
index 5bc147231..9d5c3921e 100644
--- a/tests/dbus/async-bus_client.c-expected
+++ b/tests/dbus/async-bus_client.c-expected
@@ -226,8 +226,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-bus_server.c-expected b/tests/dbus/async-bus_server.c-expected
index 2986ba176..014c26f94 100644
--- a/tests/dbus/async-bus_server.c-expected
+++ b/tests/dbus/async-bus_server.c-expected
@@ -188,8 +188,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-connection_client.c-expected b/tests/dbus/async-connection_client.c-expected
index 30ee60393..60becc0d0 100644
--- a/tests/dbus/async-connection_client.c-expected
+++ b/tests/dbus/async-connection_client.c-expected
@@ -226,8 +226,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-connection_server.c-expected b/tests/dbus/async-connection_server.c-expected
index ef52a336d..c1c589bb3 100644
--- a/tests/dbus/async-connection_server.c-expected
+++ b/tests/dbus/async-connection_server.c-expected
@@ -188,8 +188,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-errors_client.c-expected b/tests/dbus/async-errors_client.c-expected
index 4f9a12a28..c8b334397 100644
--- a/tests/dbus/async-errors_client.c-expected
+++ b/tests/dbus/async-errors_client.c-expected
@@ -662,8 +662,7 @@ _dbus_test_test_void_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test_void_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -711,8 +710,7 @@ _dbus_test_test_int_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -764,8 +762,7 @@ _dbus_test_test_string_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -812,8 +809,7 @@ _dbus_test_test_cancellable_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test_cancellable_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-errors_server.c-expected b/tests/dbus/async-errors_server.c-expected
index 819beebe7..702f27b11 100644
--- a/tests/dbus/async-errors_server.c-expected
+++ b/tests/dbus/async-errors_server.c-expected
@@ -668,8 +668,7 @@ _dbus_test_test_void_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test_void_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -717,8 +716,7 @@ _dbus_test_test_int_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -770,8 +768,7 @@ _dbus_test_test_string_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -818,8 +815,7 @@ _dbus_test_test_cancellable_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test_cancellable_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async-no-reply_client.c-expected b/tests/dbus/async-no-reply_client.c-expected
index abb397e7d..2077f8780 100644
--- a/tests/dbus/async-no-reply_client.c-expected
+++ b/tests/dbus/async-no-reply_client.c-expected
@@ -519,8 +519,7 @@ _dbus_test_list_messages_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_list_messages_finish ((Test*) source_object, _res_, &result_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -576,8 +575,7 @@ _dbus_test_post_message_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_post_message_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/async_client.c-expected b/tests/dbus/async_client.c-expected
index 659449fc2..fd2848a5f 100644
--- a/tests/dbus/async_client.c-expected
+++ b/tests/dbus/async_client.c-expected
@@ -571,8 +571,7 @@ _dbus_test_test_void_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test_void_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -620,8 +619,7 @@ _dbus_test_test_int_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -673,8 +671,7 @@ _dbus_test_test_string_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/basic-types_client.c-expected b/tests/dbus/basic-types_client.c-expected
index 6d1d4b65c..0621c47c4 100644
--- a/tests/dbus/basic-types_client.c-expected
+++ b/tests/dbus/basic-types_client.c-expected
@@ -532,8 +532,7 @@ _dbus_test_test_void (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_void (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -565,8 +564,7 @@ _dbus_test_test_int (Test* self,
        g_variant_unref (_tmp7_);
        result = test_test_int (self, i, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -600,8 +598,7 @@ _dbus_test_test_string (Test* self,
        g_variant_unref (_tmp8_);
        result = test_test_string (self, s, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug602003_client.c-expected b/tests/dbus/bug602003_client.c-expected
index 38836347a..67aaa5ebb 100644
--- a/tests/dbus/bug602003_client.c-expected
+++ b/tests/dbus/bug602003_client.c-expected
@@ -224,8 +224,7 @@ _dbus_test_test_string (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_test_string (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug735437_client.c-expected b/tests/dbus/bug735437_client.c-expected
index dae32bff8..0d1bf6e9e 100644
--- a/tests/dbus/bug735437_client.c-expected
+++ b/tests/dbus/bug735437_client.c-expected
@@ -482,8 +482,7 @@ _dbus_test_array (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_array (self, &result_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -522,8 +521,7 @@ _dbus_test_multi_array (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_multi_array (self, &result_length1, &result_length2, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -569,8 +567,7 @@ _dbus_test_multi_array2 (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_multi_array2 (self, &result_length1, &result_length2, &result_length3, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug782719_client.c-expected b/tests/dbus/bug782719_client.c-expected
index a5883c89f..1c3c1fe2c 100644
--- a/tests/dbus/bug782719_client.c-expected
+++ b/tests/dbus/bug782719_client.c-expected
@@ -247,8 +247,7 @@ _dbus_test_test_nested_dict (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_test_nested_dict (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug783002_client.c-expected b/tests/dbus/bug783002_client.c-expected
index f87ad4c6a..796a28395 100644
--- a/tests/dbus/bug783002_client.c-expected
+++ b/tests/dbus/bug783002_client.c-expected
@@ -379,8 +379,7 @@ _dbus_test_test_array_lifetime_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_array_lifetime_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug783002_server.c-expected b/tests/dbus/bug783002_server.c-expected
index 3b2a6e4a0..373027c43 100644
--- a/tests/dbus/bug783002_server.c-expected
+++ b/tests/dbus/bug783002_server.c-expected
@@ -430,8 +430,7 @@ _dbus_test_test_array_lifetime_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_array_lifetime_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/bug792277.c-expected b/tests/dbus/bug792277.c-expected
index 63cea38d3..f43be7557 100644
--- a/tests/dbus/bug792277.c-expected
+++ b/tests/dbus/bug792277.c-expected
@@ -365,8 +365,7 @@ _dbus_ifoo_method0 (IFoo* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        ifoo_method0 (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -391,8 +390,7 @@ _dbus_ifoo_method1 (IFoo* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        ifoo_method1 (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -572,8 +570,7 @@ _dbus_foo_method0 (Foo* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        foo_method0 (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -598,8 +595,7 @@ _dbus_foo_method1 (Foo* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        foo_method1 (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/connection_client.c-expected b/tests/dbus/connection_client.c-expected
index d25dbb971..026ef7bf4 100644
--- a/tests/dbus/connection_client.c-expected
+++ b/tests/dbus/connection_client.c-expected
@@ -217,8 +217,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/connection_server.c-expected b/tests/dbus/connection_server.c-expected
index 3dabf4b27..ab9db7747 100644
--- a/tests/dbus/connection_server.c-expected
+++ b/tests/dbus/connection_server.c-expected
@@ -188,8 +188,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/dicts_client.c-expected b/tests/dbus/dicts_client.c-expected
index d7de6e2fc..6e6aee9ea 100644
--- a/tests/dbus/dicts_client.c-expected
+++ b/tests/dbus/dicts_client.c-expected
@@ -238,8 +238,7 @@ _dbus_test_test_dict (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_test_dict (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/dicts_server.c-expected b/tests/dbus/dicts_server.c-expected
index 90cafa765..5787f45d7 100644
--- a/tests/dbus/dicts_server.c-expected
+++ b/tests/dbus/dicts_server.c-expected
@@ -586,8 +586,7 @@ _dbus_test_interface_bar_foo (TestInterfaceBar* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_interface_bar_foo (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/dynamic-method_server.c-expected b/tests/dbus/dynamic-method_server.c-expected
index f8864be40..d99ad9612 100644
--- a/tests/dbus/dynamic-method_server.c-expected
+++ b/tests/dbus/dynamic-method_server.c-expected
@@ -212,8 +212,7 @@ _dbus_test_do_foo (Test* self,
        g_variant_unref (_tmp0_);
        result = test_do_foo (self, i, &s, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/enum-string-marshalling.c-expected b/tests/dbus/enum-string-marshalling.c-expected
index bf75b7b5a..48974d471 100644
--- a/tests/dbus/enum-string-marshalling.c-expected
+++ b/tests/dbus/enum-string-marshalling.c-expected
@@ -591,8 +591,7 @@ _dbus_test_test1 (Test* self,
        _ready_data->e = foo_enum_from_string (g_variant_get_string (_tmp0_, NULL), &error);
        g_variant_unref (_tmp0_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        test_test1 (self, _ready_data->e, (GAsyncReadyCallback) _dbus_test_test1_ready, _ready_data);
@@ -613,8 +612,7 @@ _dbus_test_test1_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        test_test1_finish ((Test*) source_object, _res_, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -645,14 +643,12 @@ _dbus_test_test2 (Test* self,
        e = foo_enum_from_string (g_variant_get_string (_tmp1_, NULL), &error);
        g_variant_unref (_tmp1_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        test_test2 (self, e, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -685,8 +681,7 @@ _dbus_test_test3 (Test* self,
        e1 = foo_enum_from_string (g_variant_get_string (_tmp2_, NULL), &error);
        g_variant_unref (_tmp2_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _tmp3_ = g_variant_iter_next_value (&_arguments_iter);
@@ -696,14 +691,12 @@ _dbus_test_test3 (Test* self,
        e2 = foo_enum_from_string (g_variant_get_string (_tmp4_, NULL), &error);
        g_variant_unref (_tmp4_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        test_test3 (self, e1, fd, e2, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -732,8 +725,7 @@ _dbus_test_test4 (Test* self,
        e = foo_enum_from_string (g_variant_get_string (_tmp5_, NULL), &error);
        g_variant_unref (_tmp5_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        test_test4 (self, e);
@@ -762,8 +754,7 @@ _dbus_test_test5 (Test* self,
        _ready_data->e = foo_enum_from_string (g_variant_get_string (_tmp6_, NULL), &error);
        g_variant_unref (_tmp6_);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        test_test5 (self, _ready_data->e, (GAsyncReadyCallback) _dbus_test_test5_ready, _ready_data);
diff --git a/tests/dbus/errors_client.c-expected b/tests/dbus/errors_client.c-expected
index f8f2acc04..b3e4476d6 100644
--- a/tests/dbus/errors_client.c-expected
+++ b/tests/dbus/errors_client.c-expected
@@ -476,8 +476,7 @@ _dbus_test_test_void (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_void (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -509,8 +508,7 @@ _dbus_test_test_int (Test* self,
        g_variant_unref (_tmp6_);
        result = test_test_int (self, i, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -544,8 +542,7 @@ _dbus_test_test_string (Test* self,
        g_variant_unref (_tmp7_);
        result = test_test_string (self, s, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -577,8 +574,7 @@ _dbus_test_test_cancellable (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_cancellable (self, NULL, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -603,8 +599,7 @@ _dbus_test_test_custom_error (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_custom_error (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/errors_server.c-expected b/tests/dbus/errors_server.c-expected
index 805cf6aae..c26fe466e 100644
--- a/tests/dbus/errors_server.c-expected
+++ b/tests/dbus/errors_server.c-expected
@@ -312,8 +312,7 @@ _dbus_test_test_void (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_void (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -345,8 +344,7 @@ _dbus_test_test_int (Test* self,
        g_variant_unref (_tmp0_);
        result = test_test_int (self, i, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -380,8 +378,7 @@ _dbus_test_test_string (Test* self,
        g_variant_unref (_tmp1_);
        result = test_test_string (self, s, &t, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -413,8 +410,7 @@ _dbus_test_test_cancellable (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_cancellable (self, NULL, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -439,8 +435,7 @@ _dbus_test_test_custom_error (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        test_test_custom_error (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor-async_client.c-expected 
b/tests/dbus/filedescriptor-async_client.c-expected
index 0c6bcb8d0..48950f085 100644
--- a/tests/dbus/filedescriptor-async_client.c-expected
+++ b/tests/dbus/filedescriptor-async_client.c-expected
@@ -403,8 +403,7 @@ _dbus_test_test_in (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        test_test_in (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_in_ready, _ready_data);
@@ -430,8 +429,7 @@ _dbus_test_test_in_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_in_finish ((Test*) source_object, _res_, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor-async_server.c-expected 
b/tests/dbus/filedescriptor-async_server.c-expected
index 33898dab0..cad4f9924 100644
--- a/tests/dbus/filedescriptor-async_server.c-expected
+++ b/tests/dbus/filedescriptor-async_server.c-expected
@@ -430,8 +430,7 @@ _dbus_test_test_in (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        test_test_in (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_in_ready, _ready_data);
@@ -457,8 +456,7 @@ _dbus_test_test_in_ready (GObject * source_object,
        invocation = _ready_data->_invocation_;
        result = test_test_in_finish ((Test*) source_object, _res_, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor-errors_client.c-expected 
b/tests/dbus/filedescriptor-errors_client.c-expected
index dde04e5dd..81354210a 100644
--- a/tests/dbus/filedescriptor-errors_client.c-expected
+++ b/tests/dbus/filedescriptor-errors_client.c-expected
@@ -244,14 +244,12 @@ _dbus_test_test (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        result = test_test (self, output_stream, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor-errors_server.c-expected 
b/tests/dbus/filedescriptor-errors_server.c-expected
index 6067ff0bb..ffebe40d7 100644
--- a/tests/dbus/filedescriptor-errors_server.c-expected
+++ b/tests/dbus/filedescriptor-errors_server.c-expected
@@ -228,14 +228,12 @@ _dbus_test_test (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        test_test (self, output_stream, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor_client.c-expected b/tests/dbus/filedescriptor_client.c-expected
index d22be7c38..82312fc95 100644
--- a/tests/dbus/filedescriptor_client.c-expected
+++ b/tests/dbus/filedescriptor_client.c-expected
@@ -274,14 +274,12 @@ _dbus_test_test_in (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        result = test_test_in (self, i, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/filedescriptor_server.c-expected b/tests/dbus/filedescriptor_server.c-expected
index 86a6b71c3..ea51e67d3 100644
--- a/tests/dbus/filedescriptor_server.c-expected
+++ b/tests/dbus/filedescriptor_server.c-expected
@@ -324,14 +324,12 @@ _dbus_test_test_in (Test* self,
                g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
        }
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        result = test_test_in (self, i, &j, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/generics_client.c-expected b/tests/dbus/generics_client.c-expected
index eaada2f07..71b18d563 100644
--- a/tests/dbus/generics_client.c-expected
+++ b/tests/dbus/generics_client.c-expected
@@ -224,8 +224,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/generics_server.c-expected b/tests/dbus/generics_server.c-expected
index 92346b30d..a69750d2c 100644
--- a/tests/dbus/generics_server.c-expected
+++ b/tests/dbus/generics_server.c-expected
@@ -199,8 +199,7 @@ _dbus_test_get_test (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_get_test (self, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/no-reply_client.c-expected b/tests/dbus/no-reply_client.c-expected
index 106c9a2b2..ea44e8ea4 100644
--- a/tests/dbus/no-reply_client.c-expected
+++ b/tests/dbus/no-reply_client.c-expected
@@ -444,8 +444,7 @@ _dbus_test_list_messages (Test* self,
        g_variant_iter_init (&_arguments_iter, _parameters_);
        result = test_list_messages (self, &result_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -483,8 +482,7 @@ _dbus_test_post_message (Test* self,
        g_variant_unref (_tmp7_);
        test_post_message (self, message, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/rawvariants_client.c-expected b/tests/dbus/rawvariants_client.c-expected
index 287614547..7137822ee 100644
--- a/tests/dbus/rawvariants_client.c-expected
+++ b/tests/dbus/rawvariants_client.c-expected
@@ -492,8 +492,7 @@ _dbus_test_test_method (Test* self,
        g_variant_unref (_tmp5_);
        result = test_test_method (self, j, k, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -853,8 +852,7 @@ _dbus_test_raw_test_method (TestRaw* self,
        k = g_variant_iter_next_value (&_arguments_iter);
        result = test_raw_test_method (self, j, k, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/signals_client.c-expected b/tests/dbus/signals_client.c-expected
index b172477d0..0cf155bf5 100644
--- a/tests/dbus/signals_client.c-expected
+++ b/tests/dbus/signals_client.c-expected
@@ -422,8 +422,7 @@ _dbus_test_do_foo (Test* self,
        g_variant_unref (_tmp8_);
        test_do_foo (self, i, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -475,8 +474,7 @@ _dbus_test_do_bar (Test* self,
        g_variant_unref (_tmp9_);
        test_do_bar (self, baz, baz_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/signals_server.c-expected b/tests/dbus/signals_server.c-expected
index da9b02267..d9876992f 100644
--- a/tests/dbus/signals_server.c-expected
+++ b/tests/dbus/signals_server.c-expected
@@ -269,8 +269,7 @@ _dbus_test_do_foo (Test* self,
        g_variant_unref (_tmp0_);
        test_do_foo (self, i, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                return;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
@@ -322,8 +321,7 @@ _dbus_test_do_bar (Test* self,
        g_variant_unref (_tmp1_);
        test_do_bar (self, baz, baz_length1, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
index 91c61053a..3345df8c2 100644
--- a/tests/dbus/structs_client.c-expected
+++ b/tests/dbus/structs_client.c-expected
@@ -468,8 +468,7 @@ _dbus_test_test_struct (Test* self,
        g_variant_unref (_tmp16_);
        test_test_struct (self, &f, &g, &result, &error);
        if (error) {
-               g_dbus_method_invocation_return_gerror (invocation, error);
-               g_error_free (error);
+               g_dbus_method_invocation_take_error (invocation, error);
                goto _error;
        }
        _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));


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