[evolution-patches] Fixes bug #65200 [calendar]



Hi,
   The connection variable to the server was not removed from the has
table in the finalize method since all the private variables were set to
null by the dispose method which is called prior to finalize method.
When the connect to server is called for the same account, the hash
table will return the connection variable which has been disposed and
eds crashes at E_IS_GW_CONNECTION (cnc). Have attached a fix for this.

thanks, chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.70
diff -u -p -r1.70 ChangeLog
--- ChangeLog	7 Oct 2004 06:45:00 -0000	1.70
+++ ChangeLog	7 Oct 2004 15:35:06 -0000
@@ -1,5 +1,13 @@
 2004-10-07  Chenthill Palanisamy <pchenthill novell com>
 
+	Fixes #65200
+	* e-gw-connection.c (e_gw_connection_dispose), 
+	(e_gw_connection_finalize):
+	Remove the connection from the hash table in dispose
+	method.
+
+2004-10-07  Chenthill Palanisamy <pchenthill novell com>
+
 	Partially Fixes #67031
 	* e-gw-item.c (e_gw_item_new_from_soap_parameter):
 	Get the value of the completed element comparing with 
Index: e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.83
diff -u -p -r1.83 e-gw-connection.c
--- e-gw-connection.c	5 Oct 2004 11:27:30 -0000	1.83
+++ e-gw-connection.c	7 Oct 2004 15:35:06 -0000
@@ -134,11 +134,32 @@ e_gw_connection_dispose (GObject *object
 {
 	EGwConnection *cnc = (EGwConnection *) object;
 	EGwConnectionPrivate *priv;
-
+	char *hash_key;
+	gpointer orig_key, orig_value;
+	
 	g_return_if_fail (E_IS_GW_CONNECTION (cnc));
 	
 	priv = cnc->priv;
 	printf ("gw connection dispose \n");
+	
+	/* removed the connection from the hash table */
+	if (loaded_connections != NULL) {
+		hash_key = g_strdup_printf ("%s:%s %s",
+					    priv->username ? priv->username : "",
+					    priv->password ? priv->password : "",
+					    priv->uri);
+		if (g_hash_table_lookup_extended (loaded_connections, hash_key, &orig_key, &orig_value)) {
+			g_hash_table_remove (loaded_connections, hash_key);
+			if (g_hash_table_size (loaded_connections) == 0) {
+				g_hash_table_destroy (loaded_connections);
+				loaded_connections = NULL;
+			}
+
+			g_free (orig_key);
+		}
+		g_free (hash_key);
+	}
+	
 	if (priv) {
 		if (priv->session_id) {
 			logout (cnc);
@@ -188,8 +209,6 @@ e_gw_connection_dispose (GObject *object
 static void
 e_gw_connection_finalize (GObject *object)
 {
-	char *hash_key;
-	gpointer orig_key, orig_value;
 	EGwConnection *cnc = (EGwConnection *) object;
 	EGwConnectionPrivate *priv;
 
@@ -200,24 +219,6 @@ e_gw_connection_finalize (GObject *objec
 	/* clean up */
 	g_free (priv);
 	cnc->priv = NULL;
-
-	/* removed the connection from the hash table */
-	if (loaded_connections != NULL) {
-		hash_key = g_strdup_printf ("%s:%s %s",
-					    priv->username ? priv->username : "",
-					    priv->password ? priv->password : "",
-					    priv->uri);
-		if (g_hash_table_lookup_extended (loaded_connections, hash_key, &orig_key, &orig_value)) {
-			g_hash_table_remove (loaded_connections, hash_key);
-			if (g_hash_table_size (loaded_connections) == 0) {
-				g_hash_table_destroy (loaded_connections);
-				loaded_connections = NULL;
-			}
-
-			g_free (orig_key);
-		}
-		g_free (hash_key);
-	}
 
 	if (parent_class->finalize)
 		(* parent_class->finalize) (object);


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