Skip to content

Commit 87d8888

Browse files
Show warning if method response errors occur and error not handled. (#18946)
1 parent 5ddc122 commit 87d8888

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

shell/platform/linux/fl_method_call.cc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,22 @@ G_MODULE_EXPORT gboolean fl_method_call_respond(FlMethodCall* self,
7979
GError** error) {
8080
g_return_val_if_fail(FL_IS_METHOD_CALL(self), FALSE);
8181
g_return_val_if_fail(FL_IS_METHOD_RESPONSE(response), FALSE);
82-
return fl_method_channel_respond(self->channel, self->response_handle,
83-
response, error);
82+
83+
g_autoptr(GError) local_error = nullptr;
84+
if (!fl_method_channel_respond(self->channel, self->response_handle, response,
85+
&local_error)) {
86+
// If the developer chose not to handle the error then log it so it's not
87+
// missed.
88+
if (error == nullptr) {
89+
g_warning("Failed to send method call response: %s",
90+
local_error->message);
91+
}
92+
93+
g_propagate_error(error, local_error);
94+
return FALSE;
95+
}
96+
97+
return TRUE;
8498
}
8599

86100
G_MODULE_EXPORT gboolean fl_method_call_respond_success(FlMethodCall* self,

0 commit comments

Comments
 (0)