diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-28 08:58:20 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-28 08:58:20 +0000 |
commit | 633e485db09881d0c8dc46e76b42c26dc50efc88 (patch) | |
tree | 52c6d204b1250278884a39cf701ebde2c1b23a23 | |
parent | 4d51159349d7a034ea74174c95691ae776b015d1 (diff) |
sock_connect_async_thread(): fixed a crash when connection failed.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2310 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | libsylph/socket.c | 8 |
2 files changed, 18 insertions, 3 deletions
@@ -1,3 +1,16 @@ +2009-10-29 + + * version 3.0.0beta1 + +2009-10-28 + + * libsylph/socket.c: sock_connect_async_thread(): fixed a crash + when connection failed. + +2009-10-28 + + * src/addressbook.c: removed debug print. + 2009-10-28 * src/update_check.c: made release version have priority over diff --git a/libsylph/socket.c b/libsylph/socket.c index 566d940b..9e4ae9eb 100644 --- a/libsylph/socket.c +++ b/libsylph/socket.c @@ -1337,7 +1337,7 @@ static gpointer sock_connect_async_func(gpointer data) debug_print("sock_connect_async_func: connected\n"); g_main_context_wakeup(NULL); - return GINT_TO_POINTER(0); + return GINT_TO_POINTER(conn_data->sock ? 0 : -1); } gint sock_connect_async_thread(const gchar *hostname, gushort port) @@ -1350,6 +1350,7 @@ gint sock_connect_async_thread(const gchar *hostname, gushort port) data->hostname = g_strdup(hostname); data->port = port; data->flag = 0; + data->sock = NULL; data->thread = g_thread_create(sock_connect_async_func, data, TRUE, NULL); @@ -1368,6 +1369,7 @@ gint sock_connect_async_thread_wait(gint id, SockInfo **sock) { SockConnectData *conn_data = NULL; GList *cur; + gint ret; for (cur = sock_connect_data_list; cur != NULL; cur = cur->next) { if (((SockConnectData *)cur->data)->id == id) { @@ -1385,7 +1387,7 @@ gint sock_connect_async_thread_wait(gint id, SockInfo **sock) while (g_atomic_int_get(&conn_data->flag) == 0) event_loop_iterate(); - g_thread_join(conn_data->thread); + ret = GPOINTER_TO_INT(g_thread_join(conn_data->thread)); debug_print("sock_connect_async_thread_wait: thread exited\n"); *sock = conn_data->sock; @@ -1395,7 +1397,7 @@ gint sock_connect_async_thread_wait(gint id, SockInfo **sock) g_free(conn_data->hostname); g_free(conn_data); - return 0; + return ret; } #endif /* USE_THREADS */ |