+2005-08-13 Tor Lillqvist <tml@novell.com>
+
+ * camel.c (camel_init): Call atexit() directly on Win32, not
+ g_atexit(). As g_atexit() is currently implemented, the registered
+ function gets called when the GLib DLL is detached, not when the
+ process exits. This causes problems. Calling atexit() in the camel
+ DLL at least means the function gets called when the camel DLL is
+ detached, which works OK.
+
2005-08-12 Tor Lillqvist <tml@novell.com>
- * Makefile.am: Leave out camel-lock-client and
- camel-stream-process from libcamel-provider on Win32. Leave out
- camel-movemail and camel-sasl-kerberos4 from libcamel on
- Win32. Include camel-win32 in libcamel on Win32. Don't build
- lock-helper on Win32. Use NO_UNDEFINED. Link with CAMEL_LIBS,
- SOCKET_LIBS and REGEX_LIBS.
+ * Makefile.am: On Win32: Leave out camel-lock-client and
+ camel-stream-process from libcamel-provider. Leave out
+ camel-movemail and camel-sasl-kerberos4 from libcamel. Include
+ camel-win32 in libcamel. Don't build lock-helper. Use
+ -no-undefined. Link with CAMEL_LIBS, SOCKET_LIBS and REGEX_LIBS.
* camel-win32.c: New file, some Win32-specific functions.
camel_object_unref (certdb);
+#ifndef G_OS_WIN32
g_atexit (camel_shutdown);
+#else
+ /* In GLib (<= 2.8.0 at least, might get fixed later),
+ * g_atexit() is a function in the GLib DLL that calls the
+ * atexit() in the C runtime DLL. atexit() is implemented so
+ * that registered function will be called when the DLL
+ * containing the calling function is being detached from a
+ * process (not when exit() is called).
+ *
+ * We want to run camel_shutdown when the the process exits,
+ * or at least when the camel DLL is being detached, not when
+ * the GLib DLL is being detached.
+ */
+ atexit (camel_shutdown);
+#endif
initialised = TRUE;