Several bug fixes to libtinymail-camel
- From: Sergio Villar Senin <svillar igalia com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Several bug fixes to libtinymail-camel
- Date: Tue, 18 Nov 2008 16:18:08 +0100
Hi,
find attached a patch that fixes some memory leaks and a dangerous typo
in tny-camel-folder.c. The patch includes another minor fix, see
ChangeLog for details.
Note that most of the changes of notify_folder_observers_about_copy are
just indentations. The main fix is that the g_list_free was incorrect. I
moved the required frees to their proper places.
Br
Index: ChangeLog
===================================================================
--- ChangeLog (revision 3803)
+++ ChangeLog (working copy)
@@ -1,3 +1,12 @@
+2008-11-18 Sergio Villar Senin <svillar igalia com>
+
+ * libtinymail-camel/tny-camel-mime-part-priv.h: Moved a function
+ header into the #ifdef
+
+ * libtinymail-camel/tny-camel-folder.c: several bugfixes. Fixed an
+ invalid comparison (a typo most likely). Fixed several memory
+ leaks as well in some lists that were not freed.
+
2008-11-13 Thomas Guillem <thomas guillem gmail com>
* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-message-cache.c:
Index: libtinymail-camel/tny-camel-folder.c
===================================================================
--- libtinymail-camel/tny-camel-folder.c (revision 3803)
+++ libtinymail-camel/tny-camel-folder.c (working copy)
@@ -369,7 +369,7 @@
const char *uid = info->uid_added->pdata[i];
CamelMessageInfo *minfo = camel_folder_summary_uid (summary, uid);
- if (info)
+ if (minfo)
{
TnyHeader *hdr = _tny_camel_header_new ();
@@ -3364,76 +3364,67 @@
}
-
static void
notify_folder_observers_about_copy (GList *adds, GList *rems, gboolean del, gboolean in_idle, TnySessionCamel *session)
{
- if (rems)
- {
- rems = g_list_first (rems);
- while (rems)
- {
- CpyEvent *evt = rems->data;
- if (del) {
+ if (rems) {
+ rems = g_list_first (rems);
+ while (rems) {
+ CpyEvent *evt = rems->data;
+ if (del) {
+ TnyFolderStoreChange *change = tny_folder_store_change_new (evt->str);
+
+ tny_folder_store_change_add_removed_folder (change, evt->fol);
+
+ if (TNY_IS_CAMEL_STORE_ACCOUNT (evt->str)) {
+ if (in_idle)
+ notify_folder_store_observers_about_for_store_acc_in_idle (evt->str, change, session);
+ else
+ notify_folder_store_observers_about_for_store_acc (evt->str, change, session);
+ } else {
+ if (in_idle)
+ notify_folder_store_observers_about_in_idle (evt->str, change, session);
+ else
+ notify_folder_store_observers_about (evt->str, change, session);
+ }
+
+ g_object_unref (change);
+
+ }
+ cpy_event_free (evt);
+ rems = g_list_next (rems);
+ }
+ }
+
+ if (adds) {
+ adds = g_list_first (adds);
+ while (adds) {
+ CpyEvent *evt = adds->data;
TnyFolderStoreChange *change = tny_folder_store_change_new (evt->str);
- tny_folder_store_change_add_removed_folder (change, evt->fol);
-
+ tny_folder_store_change_add_created_folder (change, evt->fol);
if (TNY_IS_CAMEL_STORE_ACCOUNT (evt->str)) {
- if (in_idle)
+ if (in_idle) {
notify_folder_store_observers_about_for_store_acc_in_idle (evt->str, change, session);
- else
+ } else {
notify_folder_store_observers_about_for_store_acc (evt->str, change, session);
+ }
} else {
- if (in_idle)
+ if (in_idle) {
notify_folder_store_observers_about_in_idle (evt->str, change, session);
- else
+ } else {
notify_folder_store_observers_about (evt->str, change, session);
+ }
}
-
g_object_unref (change);
+ cpy_event_free (evt);
+ adds = g_list_next (adds);
}
- cpy_event_free (evt);
- rems = g_list_next (rems);
}
- g_list_free (rems);
- }
- if (adds)
- {
- adds = g_list_first (adds);
-
- while (adds)
- {
- CpyEvent *evt = adds->data;
- TnyFolderStoreChange *change = tny_folder_store_change_new (evt->str);
-
- tny_folder_store_change_add_created_folder (change, evt->fol);
-
- if (TNY_IS_CAMEL_STORE_ACCOUNT (evt->str)) {
- if (in_idle) {
- notify_folder_store_observers_about_for_store_acc_in_idle (evt->str, change, session);
- } else {
- notify_folder_store_observers_about_for_store_acc (evt->str, change, session);
- }
- } else {
- if (in_idle) {
- notify_folder_store_observers_about_in_idle (evt->str, change, session);
- } else {
- notify_folder_store_observers_about (evt->str, change, session);
- }
- }
- g_object_unref (change);
-
- cpy_event_free (evt);
- adds = g_list_next (adds);
- }
- g_list_free (adds);
- }
-
- return;
+ return;
}
static CpyRecRet*
@@ -3704,6 +3695,11 @@
notify_folder_observers_about_copy (adds, rems, del, TRUE,
TNY_FOLDER_PRIV_GET_SESSION (priv));
+ if (adds)
+ g_list_free (adds);
+ if (rems)
+ g_list_free (rems);
+
_tny_session_stop_operation (TNY_FOLDER_PRIV_GET_SESSION (priv));
return retval;
@@ -3752,6 +3748,11 @@
if (info->new_name)
g_free (info->new_name);
+ if (info->rems)
+ g_list_free (info->rems);
+ if (info->adds)
+ g_list_free (info->adds);
+
/**/
camel_object_unref (info->session);
@@ -3877,6 +3878,9 @@
{
CopyFolderInfo *info = (CopyFolderInfo *) thr_user_data;
+ if (info->new_folder)
+ g_object_unref (info->new_folder);
+
if (info->new_name)
g_free (info->new_name);
if (info->err)
@@ -3884,6 +3888,11 @@
g_object_unref (info->self);
g_object_unref (info->into);
+ if (info->rems)
+ g_list_free (info->rems);
+ if (info->adds)
+ g_list_free (info->adds);
+
tny_idle_stopper_destroy (info->stopper);
info->stopper = NULL;
Index: libtinymail-camel/tny-camel-mime-part-priv.h
===================================================================
--- libtinymail-camel/tny-camel-mime-part-priv.h (revision 3803)
+++ libtinymail-camel/tny-camel-mime-part-priv.h (working copy)
@@ -37,6 +37,6 @@
#define TNY_CAMEL_MIME_PART_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_MIME_PART, TnyCamelMimePartPriv))
+void _tny_camel_mime_part_set_part (TnyCamelMimePart *self, CamelMimePart *part);
+
#endif
-
-void _tny_camel_mime_part_set_part (TnyCamelMimePart *self, CamelMimePart *part);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]