etrunko / rpms / spice-gtk

Forked from rpms/spice-gtk 4 years ago
Clone
Blob Blame History Raw
From 43fc492149767bdade118d586572a2ce5abe63fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Tue, 16 Dec 2014 18:30:02 +0100
Subject: [PATCH spice-gtk 6/6] channel: clear channel error after auth error

When entered authentication details are wrong, spice-gtk will reset
channel error, which will result in the following warning:

(remote-viewer:20753): GLib-WARNING **: GError set over the top of a
previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL
before it's set.

Clear channel error after reporting authentication error.
---
 gtk/spice-channel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index c00bb42..fb7b0d5 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2180,8 +2180,10 @@ static gboolean spice_channel_delayed_unref(gpointer data)
 
     g_return_val_if_fail(c->coroutine.coroutine.exited == TRUE, FALSE);
 
-    if (c->state == SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION)
+    if (c->state == SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION) {
         g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_ERROR_AUTH);
+        g_clear_error(&c->error);
+    }
 
     g_object_unref(G_OBJECT(data));
 
-- 
2.1.0