Save certificates _before_ calling PR_Cleanup(). Calling fsync() from
authorMatthew Barnes <mbarnes@redhat.com>
Mon, 21 Jan 2008 12:53:15 +0000 (12:53 +0000)
committerMatthew Barnes <mbarnes@src.gnome.org>
Mon, 21 Jan 2008 12:53:15 +0000 (12:53 +0000)
2008-01-21  Matthew Barnes  <mbarnes@redhat.com>

* camel.c (camel_shutdown):
Save certificates _before_ calling PR_Cleanup().  Calling fsync()
from camel_certdb_save() after we've called PR_Cleanup() appears to
trigger a race between PR_Cleanup() -- which frees a lock protecting
thread bookmarking data -- and _pt_thread_death_internal() -- which
needs to temporarily lock the thread bookmarking data.  (#445309)

svn path=/trunk/; revision=8399

camel/ChangeLog
camel/camel.c

index dab11d1..41e849b 100644 (file)
@@ -1,3 +1,12 @@
+2008-01-21  Matthew Barnes  <mbarnes@redhat.com>
+
+       * camel.c (camel_shutdown):
+       Save certificates _before_ calling PR_Cleanup().  Calling fsync()
+       from camel_certdb_save() after we've called PR_Cleanup() appears to
+       trigger a race between PR_Cleanup() -- which frees a lock protecting
+       thread bookmarking data -- and _pt_thread_death_internal() -- which
+       needs to temporarily lock the thread bookmarking data.  (#445309)
+
 2008-01-17  Matthew Barnes  <mbarnes@redhat.com>
 
        * camel-session.c (camel_session_build_password_prompt):
index 49d79f1..15b17d2 100644 (file)
@@ -54,21 +54,19 @@ camel_shutdown (void)
        if (!initialised)
                return;
 
-#if defined (HAVE_NSS) && !defined (G_OS_WIN32)
-       /* For some reason we get into trouble on Win32 if we call these.
-        * But they shouldn't be necessary as the process is exiting anywy?
-        */
-       NSS_Shutdown ();
-
-       PR_Cleanup ();
-#endif /* HAVE_NSS */
-
        certdb = camel_certdb_get_default ();
        if (certdb) {
                camel_certdb_save (certdb);
                camel_object_unref (certdb);
        }
 
+       /* These next calls must come last. */
+
+#if defined (HAVE_NSS)
+       NSS_Shutdown ();
+       PR_Cleanup ();
+#endif /* HAVE_NSS */
+
        initialised = FALSE;
 }