Patch: add camel folder reasons to sentbox and outbox while send queue is processed



	Hi,

	This patch adds the tny camel folder reasons to the sentbox and outbox
while the send queue is processed, as we may have the reason counter get
to 0 on the send process (and then get crashes because of this).

	The changelog entry would be:

* libtinymail-camel/tny-camel-send-queue.c:
        * Add camel folder reason to sentbox and outbox while sending,
          as we can get unreasons and have then crash because the
          message cache is freed. 

-- 
José Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c	(revision 3651)
+++ libtinymail-camel/tny-camel-send-queue.c	(working copy)
@@ -396,6 +396,8 @@
 	MainThreadInfo *info = (MainThreadInfo *) data;
 	TnySendQueue *self = info->self;
 	TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self);
+	TnyCamelFolderPriv *outbox_priv;
+	TnyCamelFolderPriv *sentbox_priv;
 	guint i = 0, length = 0;
 	TnyList *list = NULL;
 	TnyDevice *device = info->device;
@@ -613,6 +615,11 @@
 	if (info->sentbox_account)
 		g_object_unref (info->sentbox_account);
 
+	outbox_priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+	sentbox_priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+	_tny_camel_folder_unreason (outbox_priv);
+	_tny_camel_folder_unreason (sentbox_priv);
+
 	g_object_unref (info->outbox);
 	g_object_unref (info->sentbox);
 	g_object_unref (info->trans_account);
@@ -639,6 +646,8 @@
 
 		if (spriv->device && TNY_IS_DEVICE (spriv->device)) {
 			MainThreadInfo *info;
+			TnyCamelFolderPriv *outbox_priv;
+			TnyCamelFolderPriv *sentbox_priv;
 
 			info = g_slice_new0 (MainThreadInfo);
 			info->self = g_object_ref (self);
@@ -646,6 +655,10 @@
 
 			info->outbox = tny_send_queue_get_outbox (self);
 			info->sentbox = get_sentbox (self);
+			outbox_priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->outbox);
+			sentbox_priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->sentbox);
+			_tny_camel_folder_reason (outbox_priv);
+			_tny_camel_folder_reason (sentbox_priv);
 
 			if (!info->outbox || !info->sentbox) {
 
@@ -672,8 +685,11 @@
 
 			priv->thread = g_thread_create (thread_main, info, FALSE, NULL);
 
-			if (priv->thread == NULL)
+			if (priv->thread == NULL) {
 				emit_queue_control_signals (self, TNY_SEND_QUEUE_STOP);
+				_tny_camel_folder_unreason (outbox_priv);
+				_tny_camel_folder_unreason (sentbox_priv);
+			}
 		}
 	}
 


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