From: Milan Crha Date: Wed, 6 Aug 2008 09:17:47 +0000 (+0000) Subject: ** Part of fix for bug #546397 X-Git-Tag: upstream/3.7.4~4746 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86ceee97866abc9ad911da68fb2d68bf4362ecbd;p=platform%2Fupstream%2Fevolution-data-server.git ** Part of fix for bug #546397 2008-08-06 Milan Crha ** 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. svn path=/trunk/; revision=9274 --- diff --git a/camel/ChangeLog b/camel/ChangeLog index c720f4b..8ba3a89 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2008-08-06 Milan Crha + + ** Part of fix for bug #546397 + + * camel-store.c: (construct): Do not use NULL in g_file_test. + * camel-folder-search.c: (read_uid_callback): Cast to right type. + * camel-folder-summary.c: (camel_folder_summary_remove_range): + Do not leak objects from loaded_infos array. + 2008-08-05 Chenthill Palanisamy Fixes part of #533823 diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 8b8e589..d4e0689 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -1414,6 +1414,6 @@ read_uid_callback (void * ref, int ncol, char ** cols, char **name) 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; } diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index a5762e7..4ed71ea 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -2157,10 +2157,15 @@ camel_folder_summary_remove_range (CamelFolderSummary *s, int start, int end) 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); diff --git a/camel/camel-store.c b/camel/camel-store.c index fc7b8db..9446a72 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -206,7 +206,7 @@ construct (CamelService *service, CamelSession *session, 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 @@ construct (CamelService *service, CamelSession *session, 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)) { diff --git a/camel/providers/nntp/ChangeLog b/camel/providers/nntp/ChangeLog index 5219ccb..e78c12d 100644 --- a/camel/providers/nntp/ChangeLog +++ b/camel/providers/nntp/ChangeLog @@ -1,3 +1,10 @@ +2008-08-06 Milan Crha + + ** Part of fix for bug #546397 + + * camel-nntp-folder.c: (nntp_folder_search_free): + Guard access to 'search' member with its lock. + 2008-08-01 Matthew Barnes * camel-nntp-store-summary.c: diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 763baef..f561b1f 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -300,8 +300,10 @@ static void 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