From 8f727571f7719045938ec876c4441ed4c6ef8119 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 10 Jun 2005 05:28:40 +0000 Subject: fixed possible crash (take 2). git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@329 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 4 ++++ ChangeLog.ja | 4 ++++ src/summaryview.c | 42 +++++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c2de2f2..165d701d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-06-10 + + * src/summaryview.c: fixed possible crash (take 2). + 2005-06-10 * src/summaryview.c: fixed possible crash when sorted by diff --git a/ChangeLog.ja b/ChangeLog.ja index 0d8c7a53..c00adf05 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,7 @@ +2005-06-10 + + * src/summaryview.c: クラッシュする可能性があったのを修正(take 2)。 + 2005-06-10 * src/summaryview.c: From/To/Subject でソートしたときにクラッシュする diff --git a/src/summaryview.c b/src/summaryview.c index 34e758eb..4043f4b5 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -4705,7 +4705,7 @@ static void summary_drag_data_get(GtkWidget *widget, static gint func_name(GtkTreeModel *model, \ GtkTreeIter *a, GtkTreeIter *b, gpointer data) \ { \ - MsgInfo *msginfo_a, *msginfo_b; \ + MsgInfo *msginfo_a = NULL, *msginfo_b = NULL; \ \ gtk_tree_model_get(model, a, S_COL_MSG_INFO, &msginfo_a, -1); \ gtk_tree_model_get(model, b, S_COL_MSG_INFO, &msginfo_b, -1); \ @@ -4735,7 +4735,7 @@ CMP_FUNC_DEF(summary_cmp_by_date, msginfo_a->date_t - msginfo_b->date_t) static gint func_name(GtkTreeModel *model, \ GtkTreeIter *a, GtkTreeIter *b, gpointer data) \ { \ - MsgInfo *msginfo_a, *msginfo_b; \ + MsgInfo *msginfo_a = NULL, *msginfo_b = NULL; \ \ gtk_tree_model_get(model, a, S_COL_MSG_INFO, &msginfo_a, -1); \ gtk_tree_model_get(model, b, S_COL_MSG_INFO, &msginfo_b, -1); \ @@ -4756,23 +4756,23 @@ CMP_FUNC_DEF(summary_cmp_by_to, to); #undef CMP_FUNC_DEF -static gint summary_cmp_by_subject(GtkTreeModel *model, \ - GtkTreeIter *a, GtkTreeIter *b, \ - gpointer data) \ -{ \ - MsgInfo *msginfo_a, *msginfo_b; \ - \ - gtk_tree_model_get(model, a, S_COL_MSG_INFO, &msginfo_a, -1); \ - gtk_tree_model_get(model, b, S_COL_MSG_INFO, &msginfo_b, -1); \ - \ - if (!msginfo_a || !msginfo_b) \ - return 0; \ - \ - if (msginfo_a->subject == NULL) \ - return -(msginfo_b->subject != NULL); \ - if (msginfo_b->subject == NULL) \ - return (msginfo_a->subject != NULL); \ - \ - return subject_compare_for_sort \ - (msginfo_a->subject, msginfo_b->subject); \ +static gint summary_cmp_by_subject(GtkTreeModel *model, + GtkTreeIter *a, GtkTreeIter *b, + gpointer data) +{ + MsgInfo *msginfo_a = NULL, *msginfo_b = NULL; + + gtk_tree_model_get(model, a, S_COL_MSG_INFO, &msginfo_a, -1); + gtk_tree_model_get(model, b, S_COL_MSG_INFO, &msginfo_b, -1); + + if (!msginfo_a || !msginfo_b) + return 0; + + if (msginfo_a->subject == NULL) + return -(msginfo_b->subject != NULL); + if (msginfo_b->subject == NULL) + return (msginfo_a->subject != NULL); + + return subject_compare_for_sort + (msginfo_a->subject, msginfo_b->subject); } -- cgit v1.2.3