Don't load the soup session in idle callback

Otherwise there's a race condition which may lead to
not having setup the session before loading the first
page or worse, crash in libSoup.
This commit is contained in:
Christian Dywan 2011-04-16 04:26:28 +02:00
parent 08b756b0a6
commit 0925d31985

View file

@ -1228,6 +1228,8 @@ midori_load_soup_session_full (gpointer settings)
gchar* config_file; gchar* config_file;
SoupSessionFeature* feature; SoupSessionFeature* feature;
midori_load_soup_session (settings);
config_file = build_config_filename ("logins"); config_file = build_config_filename ("logins");
feature = g_object_new (KATZE_TYPE_HTTP_AUTH, "filename", config_file, NULL); feature = g_object_new (KATZE_TYPE_HTTP_AUTH, "filename", config_file, NULL);
g_free (config_file); g_free (config_file);
@ -1246,8 +1248,6 @@ midori_load_soup_session_full (gpointer settings)
soup_session_add_feature (session, feature); soup_session_add_feature (session, feature);
g_object_unref (feature); g_object_unref (feature);
g_idle_add (midori_load_soup_session, settings);
return FALSE; return FALSE;
} }
@ -2267,7 +2267,7 @@ main (int argc,
G_CALLBACK (midori_soup_session_block_uris_cb), G_CALLBACK (midori_soup_session_block_uris_cb),
g_strdup (block_uris)); g_strdup (block_uris));
midori_setup_inactivity_reset (browser, inactivity_reset, webapp); midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
g_idle_add (midori_load_soup_session, settings); midori_load_soup_session (settings);
midori_startup_timer ("App created: \t%f"); midori_startup_timer ("App created: \t%f");
gtk_main (); gtk_main ();
return 0; return 0;