From c5806a8468e8f89e2c2b83cb924a81bea45c7194 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Wed, 10 Jun 2020 10:52:50 +1200 Subject: [PATCH] Show warning if method response errors occur and error not handled. --- shell/platform/linux/fl_method_call.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/shell/platform/linux/fl_method_call.cc b/shell/platform/linux/fl_method_call.cc index 2cc96e01002fa..2bf9c28e7fa07 100644 --- a/shell/platform/linux/fl_method_call.cc +++ b/shell/platform/linux/fl_method_call.cc @@ -79,8 +79,22 @@ G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall* self, GError** error) { g_return_val_if_fail(FL_IS_METHOD_CALL(self), FALSE); g_return_val_if_fail(FL_IS_METHOD_RESPONSE(response), FALSE); - return fl_method_channel_respond(self->channel, self->response_handle, - response, error); + + g_autoptr(GError) local_error = nullptr; + if (!fl_method_channel_respond(self->channel, self->response_handle, response, + &local_error)) { + // If the developer chose not to handle the error then log it so it's not + // missed. + if (error == nullptr) { + g_warning("Failed to send method call response: %s", + local_error->message); + } + + g_propagate_error(error, local_error); + return FALSE; + } + + return TRUE; } G_MODULE_EXPORT gboolean fl_method_call_respond_success(FlMethodCall* self,