Re: [gtk-vnc-devel] Error on GLib



Jonh Wendell wrote:
Hi, folks.

I'm getting an glib error when connecting to a host that needs password:

(vinagre:8641): GLib-GObject-CRITICAL **: g_value_get_param: assertion
`G_VALUE_HOLDS_PARAM (value)' failed

This error (on vinagre, actually it's a warning, on gvncviewer it's a
fatal error) happens when vncDisplay emits the signal
VNC_AUTH_CREDENTIAL (vncdisplay.c:618).

I'm running Ubuntu Hardy (GNOME 2.21 and deps). So, perhaps it's
something new in GLib? On Gutsy I didn't notice that.

Can you try the following patch. The memory location for the data may be changing which is causing garbage to be passed to emit. We probably haven't run into this before because of the fact that we prealloc enough storage for the operations that are performed.

Regards,

Anthony Liguori

Thanks,

diff -r 27e7004a3772 src/vncdisplay.c
--- a/src/vncdisplay.c	Fri Jan 25 08:53:20 2008 -0600
+++ b/src/vncdisplay.c	Sat Jan 26 13:51:10 2008 -0600
@@ -591,36 +591,36 @@ static gboolean on_auth_cred(void *opaqu
 static gboolean on_auth_cred(void *opaque)
 {
 	VncDisplay *obj = VNC_DISPLAY(opaque);
-	GValueArray *credList;
+	GValueArray *cred_list;
 	GValue username, password, clientname;
 
 	memset(&username, 0, sizeof(username));
 	memset(&password, 0, sizeof(password));
 	memset(&clientname, 0, sizeof(clientname));
 
-	credList = g_value_array_new(2);
+	cred_list = g_value_array_new(0);
 	if (gvnc_wants_credential_username(obj->priv->gvnc)) {
 		g_value_init(&username, G_PARAM_SPEC_VALUE_TYPE(signalCredParam));
 		g_value_set_enum(&username, VNC_DISPLAY_CREDENTIAL_USERNAME);
-		g_value_array_append(credList, &username);
+		cred_list = g_value_array_append(cred_list, &username);
 	}
 	if (gvnc_wants_credential_password(obj->priv->gvnc)) {
 		g_value_init(&password, G_PARAM_SPEC_VALUE_TYPE(signalCredParam));
 		g_value_set_enum(&password, VNC_DISPLAY_CREDENTIAL_PASSWORD);
-		g_value_array_append(credList, &password);
+		cred_list = g_value_array_append(cred_list, &password);
 	}
 	if (gvnc_wants_credential_x509(obj->priv->gvnc)) {
 		g_value_init(&clientname, G_PARAM_SPEC_VALUE_TYPE(signalCredParam));
 		g_value_set_enum(&clientname, VNC_DISPLAY_CREDENTIAL_CLIENTNAME);
-		g_value_array_append(credList, &clientname);
+		cred_list = g_value_array_append(cred_list, &clientname);
 	}
 
 	g_signal_emit (G_OBJECT (obj),
 		       signals[VNC_AUTH_CREDENTIAL],
 		       0,
-		       credList);
-
-	g_value_array_free(credList);
+		       cred_list);
+
+	g_value_array_free(cred_list);
 
 	return TRUE;
 }


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