Patch: avoid using PR_Cleanup



	Hi,

	This bug is simple. On shutting down camel, we were calling
NSS_Shutdown and PR_Cleanup. With this, we remove PR_Cleanup, as it's
not safe in complex applications (it does not warrant that other threads
are running after removing the common threads control information in
NSPR).

	You can see more information here:
	https://bugzilla.mozilla.org/show_bug.cgi?id=54189#c1

	All the camel based apps (modest, other tinymail based, evolution,
evolution-data-server based, etc) can get the same issue and in fact
there are crash reports very similar. Other apps as curl, or firefox, do
not use PR_Cleanup at all, and this seems it was not really required.

Changelog entry:
* libtinymail-camel/camel-lite/camel/camel.c:
  Drop usage of PR_Cleanup on shutting down camel, as this is not safe,
  nor required. This method is responsible for freeing the common
  threads management code, including the lock that's accessed on the
  crash in __nptl_deallocate_tsd.

-- 
José Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/tny-camel-folder.c
===================================================================
--- libtinymail-camel/tny-camel-folder.c	(revision 3716)
+++ libtinymail-camel/tny-camel-folder.c	(working copy)
@@ -2431,6 +2431,11 @@
 	if (info->err)
 		g_error_free (info->err);
 
+	if (info->msg) {
+		g_object_unref (info->msg);
+		info->msg = NULL;
+	}
+
 	tny_idle_stopper_destroy (info->stopper);
 	info->stopper = NULL;
 
@@ -2463,8 +2468,10 @@
 		tny_lockable_unlock (info->session->priv->ui_lock);
 	}
 
-	if (info->msg)
+	if (info->msg) {
 		g_object_unref (info->msg);
+		info->msg = NULL;
+	}
 
 	tny_idle_stopper_stop (info->stopper);
 
@@ -2570,6 +2577,11 @@
 	if (info->err)
 		g_error_free (info->err);
 
+	if (info->msg) {
+		g_object_unref (info->msg);
+		info->msg = NULL;
+	}
+
 	tny_idle_stopper_destroy (info->stopper);
 	info->stopper = NULL;
 
Index: libtinymail-camel/camel-lite/camel/camel-stream-filter.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-stream-filter.c	(revision 3716)
+++ libtinymail-camel/camel-lite/camel/camel-stream-filter.c	(working copy)
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <errno.h>
 
 #include "camel-stream-filter.h"
 
@@ -325,8 +326,10 @@
 		for (written = 0; written < len;) {
 			size_t just_written;
 			just_written = camel_stream_write (filter->source, buffer + written, len - written);
-			if (just_written == -1)
+			if (just_written == -1) {
+				g_warning ("TIMEOUT IN FILTER STREAM %s", g_strerror (errno));
 				return -1;
+			}
 			written += just_written;
 		}
 	}
Index: libtinymail-camel/camel-lite/camel/camel.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel.c	(revision 3716)
+++ libtinymail-camel/camel-lite/camel/camel.c	(working copy)
@@ -65,7 +65,6 @@
 
 #if defined (HAVE_NSS)
 	NSS_Shutdown ();
-	PR_Cleanup ();
 #endif /* HAVE_NSS */
 
 }


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