[mutter/wip/carlosg/move-pointer-onscreen: 4/8] test/utils: Make meta_test_client_do*() not crash on NULL error
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/move-pointer-onscreen: 4/8] test/utils: Make meta_test_client_do*() not crash on NULL error
- Date: Fri, 14 Jan 2022 22:36:54 +0000 (UTC)
commit 2c39d7ec8247cf7257cab2bd4e8f0ff2cc29e0a2
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Jan 14 22:07:15 2022 +0100
test/utils: Make meta_test_client_do*() not crash on NULL error
src/tests/meta-test-utils.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/tests/meta-test-utils.c b/src/tests/meta-test-utils.c
index 5a1637bcc9..5f457cb3bc 100644
--- a/src/tests/meta-test-utils.c
+++ b/src/tests/meta-test-utils.c
@@ -219,6 +219,7 @@ meta_test_client_dov (MetaTestClient *client,
{
GString *command = g_string_new (NULL);
char *line = NULL;
+ GError *local_error = NULL;
while (TRUE)
{
@@ -239,7 +240,7 @@ meta_test_client_dov (MetaTestClient *client,
g_string_append_c (command, '\n');
if (!g_data_output_stream_put_string (client->in, command->str,
- client->cancellable, error))
+ client->cancellable, &local_error))
goto out;
g_data_input_stream_read_line_async (client->out,
@@ -248,7 +249,7 @@ meta_test_client_dov (MetaTestClient *client,
test_client_line_read,
client);
- client->error = error;
+ client->error = &local_error;
g_main_loop_run (client->loop);
line = client->line;
client->line = NULL;
@@ -256,9 +257,9 @@ meta_test_client_dov (MetaTestClient *client,
if (!line)
{
- if (*error == NULL)
+ if (!local_error)
{
- g_set_error (error,
+ g_set_error (&local_error,
META_TEST_CLIENT_ERROR,
META_TEST_CLIENT_ERROR_RUNTIME_ERROR,
"test client exited");
@@ -268,7 +269,7 @@ meta_test_client_dov (MetaTestClient *client,
if (strcmp (line, "OK") != 0)
{
- g_set_error (error,
+ g_set_error (&local_error,
META_TEST_CLIENT_ERROR,
META_TEST_CLIENT_ERROR_RUNTIME_ERROR,
"%s", line);
@@ -279,7 +280,15 @@ meta_test_client_dov (MetaTestClient *client,
g_string_free (command, TRUE);
g_free (line);
- return *error == NULL;
+ if (local_error)
+ {
+ g_propagate_error (error, local_error);
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]