evolution-data-server r9274 - in trunk/camel: . providers/nntp



Author: mcrha
Date: Wed Aug  6 09:17:47 2008
New Revision: 9274
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9274&view=rev

Log:
2008-08-06  Milan Crha  <mcrha redhat com>

	** Part of fix for bug #546397

	* camel/camel-store.c: (construct): Do not use NULL in g_file_test.
	* camel/camel-folder-search.c: (read_uid_callback): Cast to right type.
	* camel/camel-folder-summary.c: (camel_folder_summary_remove_range):
	Do not leak objects from loaded_infos array.

	* camel/providers/nntp/camel-nntp-folder.c: (nntp_folder_search_free):
	Guard access to 'search' member with its lock.



Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder-search.c
   trunk/camel/camel-folder-summary.c
   trunk/camel/camel-store.c
   trunk/camel/providers/nntp/ChangeLog
   trunk/camel/providers/nntp/camel-nntp-folder.c

Modified: trunk/camel/camel-folder-search.c
==============================================================================
--- trunk/camel/camel-folder-search.c	(original)
+++ trunk/camel/camel-folder-search.c	Wed Aug  6 09:17:47 2008
@@ -1414,6 +1414,6 @@
 
 	matches = (GPtrArray *) ref;
 
-	g_ptr_array_add (matches, (GFunc) camel_pstring_strdup (cols [0]));
+	g_ptr_array_add (matches, (gpointer) camel_pstring_strdup (cols [0]));
 	return 0;
 }

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Wed Aug  6 09:17:47 2008
@@ -2157,10 +2157,15 @@
 
 		for (i = start; i < end; i++) {
 			const char *uid = s->uids->pdata[i];
+			gpointer olduid, oldinfo;
 
+			/* the uid will be freed below and will not be used because of changing size of the s->uids array */
 			uids = g_slist_prepend (uids, (gpointer) uid);
 
-			g_hash_table_remove(s->loaded_infos, uid);
+			if (g_hash_table_lookup_extended (s->loaded_infos, uid, &olduid, &oldinfo)) {
+				camel_message_info_free (oldinfo);
+				g_hash_table_remove (s->loaded_infos, uid);
+			}
 		}
 		camel_exception_init (&ex);
 

Modified: trunk/camel/camel-store.c
==============================================================================
--- trunk/camel/camel-store.c	(original)
+++ trunk/camel/camel-store.c	Wed Aug  6 09:17:47 2008
@@ -206,7 +206,7 @@
 	   CamelException *ex)
 {
 	CamelStore *store = CAMEL_STORE(service);
-	char *store_db_path;
+	char *store_db_path, *store_path = NULL;
 
 	parent_class->construct(service, session, provider, url, ex);
 	if (camel_exception_is_set (ex))
@@ -214,19 +214,20 @@
 
 	store_db_path = g_build_filename (service->url->path, CAMEL_DB_FILE, NULL);
 
-	if (strlen (store_db_path) < 2) {
-		char *store_path = camel_session_get_storage_path (session, service, ex);
+	if (!service->url->path || strlen (store_db_path) < 2) {
+		store_path = camel_session_get_storage_path (session, service, ex);
 
 		g_free (store_db_path);
 		store_db_path = g_build_filename (store_path, CAMEL_DB_FILE, NULL);
-		g_free (store_path);
 	}
 
-	if (!g_file_test(service->url->path, G_FILE_TEST_EXISTS)) {
+	if (!g_file_test (service->url->path ? service->url->path : store_path, G_FILE_TEST_EXISTS)) {
 		/* Cache might be blown. Recreate. */
-		g_mkdir_with_parents (service->url->path, S_IRWXU);
+		g_mkdir_with_parents (service->url->path ? service->url->path : store_path, S_IRWXU);
 	}
 
+	g_free (store_path);
+
 	store->cdb = camel_db_open (store_db_path, ex);
 	printf("store_db_path %s\n", store_db_path);
 	if (camel_exception_is_set (ex)) {

Modified: trunk/camel/providers/nntp/camel-nntp-folder.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-folder.c	(original)
+++ trunk/camel/providers/nntp/camel-nntp-folder.c	Wed Aug  6 09:17:47 2008
@@ -300,8 +300,10 @@
 nntp_folder_search_free (CamelFolder *folder, GPtrArray *result)
 {
 	CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
-	
+
+	CAMEL_NNTP_FOLDER_LOCK(nntp_folder, search_lock);
 	camel_folder_search_free_result (nntp_folder->search, result);
+	CAMEL_NNTP_FOLDER_UNLOCK(nntp_folder, search_lock);
 }
 
 static void           



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