Bugfix for 61408
[modest] / src / modest-main.c
index ba4242f..e0dc501 100644 (file)
@@ -85,17 +85,6 @@ on_show (GtkWidget *widget, gpointer user_data)
        modest_platform_connect_and_wait(NULL);
 }
 
-static void
-log_default_handler (const gchar *log_domain,
-                    GLogLevelFlags log_level,
-                    const gchar *message,
-                    gpointer unused_data)
-{
-       if (log_level == G_LOG_LEVEL_ERROR || 
-           log_level == G_LOG_LEVEL_CRITICAL)
-               g_print ("EEEEE ------ %s\n", message);
-}
-
 int
 main (int argc, char *argv[])
 {
@@ -126,6 +115,11 @@ main (int argc, char *argv[])
                { NULL, 0, 0, 0, NULL, NULL, NULL }
        };
 
+       /* Enable threads before anything else, to prevent memory corruption */
+       if (!g_thread_supported())
+               g_thread_init(NULL);
+       gdk_threads_init ();
+
        context = g_option_context_new (NULL);
        g_option_context_add_main_entries (context, options, NULL);
        
@@ -139,8 +133,6 @@ main (int argc, char *argv[])
        }
        g_option_context_free (context);
        
-       g_log_set_default_handler (log_default_handler, NULL);
-
        if (!modest_init_init_core ()) {
                g_printerr ("modest: cannot init modest core\n");
                return MODEST_ERR_INIT;