diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-09-25 09:42:39 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-09-25 09:42:39 +0000 |
commit | 1ff05553158408570a7cd548fdcdf4ec7be07f5d (patch) | |
tree | 3667621c49e8ba4006ad3fd6e668292b3ffb83cb /src | |
parent | cd87d5c742ab84c90e4338d46a23f17f9dbf9d2b (diff) |
fixed the handling of GDK thread lock.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2258 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/inc.c | 27 | ||||
-rw-r--r-- | src/main.c | 12 |
2 files changed, 37 insertions, 2 deletions
@@ -862,8 +862,9 @@ static IncState inc_pop3_session_do(IncSession *session) } while (session_is_connected(SESSION(pop3_session)) && - session->inc_state != INC_CANCEL) + session->inc_state != INC_CANCEL) { gtk_main_iteration(); + } if (session->inc_state == INC_SUCCESS) { switch (pop3_session->error_val) { @@ -1104,6 +1105,8 @@ static gint inc_recv_data_progressive(Session *session, guint cur_len, if (!pop3_session->new_msg_exist) return 0; + gdk_threads_enter(); + cur_total = pop3_session->cur_total_bytes + cur_len; if (cur_total > pop3_session->total_bytes) cur_total = pop3_session->total_bytes; @@ -1113,6 +1116,7 @@ static gint inc_recv_data_progressive(Session *session, guint cur_len, inc_progress_dialog_update_periodic(inc_dialog, inc_session); inc_update_folderview_periodic(inc_dialog, inc_session); + gdk_threads_leave(); return 0; } @@ -1127,11 +1131,14 @@ static gint inc_recv_data_finished(Session *session, guint len, gpointer data) inc_recv_data_progressive(session, 0, 0, inc_session); + gdk_threads_enter(); + if (POP3_SESSION(session)->state == POP3_LOGOUT) { inc_progress_dialog_update(inc_dialog, inc_session); inc_update_folderview(inc_dialog, inc_session); } + gdk_threads_leave(); return 0; } @@ -1152,14 +1159,18 @@ static gint inc_recv_message(Session *session, const gchar *msg, gpointer data) case POP3_GETRANGE_LAST: case POP3_GETRANGE_UIDL: case POP3_GETSIZE_LIST: + gdk_threads_enter(); inc_progress_dialog_update(inc_dialog, inc_session); + gdk_threads_leave(); break; case POP3_RETR: inc_recv_data_progressive(session, 0, 0, inc_session); break; case POP3_LOGOUT: + gdk_threads_enter(); inc_progress_dialog_update(inc_dialog, inc_session); inc_update_folderview(inc_dialog, inc_session); + gdk_threads_leave(); break; default: break; @@ -1180,6 +1191,10 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) g_return_val_if_fail(inc_session != NULL, DROP_ERROR); + g_print("inc_drop_message\n"); + + gdk_threads_enter(); + if (session->ac_prefs->inbox) { inbox = folder_find_item_from_identifier (session->ac_prefs->inbox); @@ -1187,8 +1202,10 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) inbox = folder_get_default_inbox(); } else inbox = folder_get_default_inbox(); - if (!inbox) + if (!inbox) { + gdk_threads_leave(); return DROP_ERROR; + } fltinfo = filter_info_new(); fltinfo->account = session->ac_prefs; @@ -1199,6 +1216,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) if (!msginfo) { g_warning("inc_drop_message: procheader_parse_file failed"); filter_info_free(fltinfo); + gdk_threads_leave(); return DROP_ERROR; } msginfo->file_path = g_strdup(file); @@ -1217,6 +1235,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) procmsg_msginfo_free(msginfo); filter_info_free(fltinfo); inc_session->inc_state = INC_ERROR; + gdk_threads_leave(); return DROP_ERROR; } } @@ -1239,6 +1258,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) procmsg_msginfo_free(msginfo); filter_info_free(fltinfo); inc_session->inc_state = INC_ERROR; + gdk_threads_leave(); return DROP_ERROR; } } @@ -1249,6 +1269,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) if (folder_item_add_msg_msginfo(inbox, msginfo, FALSE) < 0) { procmsg_msginfo_free(msginfo); filter_info_free(fltinfo); + gdk_threads_leave(); return DROP_ERROR; } fltinfo->dest_list = g_slist_append(fltinfo->dest_list, inbox); @@ -1279,6 +1300,8 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file) procmsg_msginfo_free(msginfo); filter_info_free(fltinfo); + gdk_threads_leave(); + g_print("inc_drop_message done\n"); return val; } @@ -579,6 +579,15 @@ static gint get_queued_message_num(void) return queue->total; } +#if USE_THREADS +static void event_loop_iteration_func(void) +{ + //g_print("event_loop_iteration_func start\n"); + gtk_main_iteration(); + //g_print("event_loop_iteration_func end\n"); +} +#endif + static void app_init(void) { #if USE_THREADS @@ -591,6 +600,9 @@ static void app_init(void) #endif syl_init(); +#if USE_THREADS + set_event_loop_func(event_loop_iteration_func); +#endif prog_version = PROG_VERSION; #ifdef G_OS_WIN32 |