From bbb842cbedd45a3952496bb616c0e88a0416f6a9 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 26 Jun 2006 04:03:31 +0000 Subject: made workarounds for the crash in GTK+ 2.8.x. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1089 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 5 +++++ ChangeLog.ja | 5 +++++ src/gtkutils.c | 13 +++++++++++++ src/gtkutils.h | 4 ++++ src/summaryview.c | 16 +++++----------- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f52580e..899216eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-26 + + * src/gtkutils.[ch]: gtkut_tree_view_fast_clear(): new. + * src/summaryview.c: made workarounds for the crash in GTK+ 2.8.x. + 2006-06-25 * libsylph/mh.c: mh_scan_tree_recursive(): win32: improved its diff --git a/ChangeLog.ja b/ChangeLog.ja index e0c0033e..a5643dfb 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,8 @@ +2006-06-26 + + * src/gtkutils.[ch]: gtkut_tree_view_fast_clear(): 新規。 + * src/summaryview.c: GTK+ 2.8.x におけるクラッシュを回避。 + 2006-06-25 * libsylph/mh.c: mh_scan_tree_recursive(): win32: 性能を向上。 diff --git a/src/gtkutils.c b/src/gtkutils.c index 691c3712..8898f029 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -623,6 +623,19 @@ void gtkut_tree_view_scroll_to_cell(GtkTreeView *treeview, GtkTreePath *path, gtk_tree_view_scroll_to_point(treeview, dest_x, dest_y); } +void gtkut_tree_view_fast_clear(GtkTreeView *treeview, GtkTreeStore *store) +{ +#if GTK_CHECK_VERSION(2, 8, 0) + gtk_tree_store_clear(store); +#else + /* this is faster than above, but it seems to trigger crashes in + GTK+ 2.8.x */ + gtk_tree_view_set_model(treeview, NULL); + gtk_tree_store_clear(store); + gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(store)); +#endif +} + void gtkut_combo_set_items(GtkCombo *combo, const gchar *str1, ...) { va_list args; diff --git a/src/gtkutils.h b/src/gtkutils.h index 15872de2..ebc9bfed 100644 --- a/src/gtkutils.h +++ b/src/gtkutils.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -163,6 +164,9 @@ void gtkut_tree_view_scroll_to_cell (GtkTreeView *treeview, GtkTreePath *path, gboolean align_center); +void gtkut_tree_view_fast_clear (GtkTreeView *treeview, + GtkTreeStore *store); + void gtkut_combo_set_items (GtkCombo *combo, const gchar *str1, ...); diff --git a/src/summaryview.c b/src/summaryview.c index b620f6a1..44dfd51b 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -940,9 +940,7 @@ void summary_clear_list(SummaryView *summaryview) procmsg_msg_list_free(summaryview->all_mlist); summaryview->all_mlist = NULL; - gtk_tree_view_set_model(treeview, NULL); - gtk_tree_store_clear(summaryview->store); - gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(summaryview->store)); + gtkut_tree_view_fast_clear(treeview, summaryview->store); /* ensure that the "value-changed" signal is always emitted */ adj = gtk_tree_view_get_vadjustment(treeview); @@ -5073,10 +5071,8 @@ void summary_qsearch_reset(SummaryView *summaryview) messageview_clear(summaryview->messageview); - gtk_tree_view_set_model(GTK_TREE_VIEW(summaryview->treeview), NULL); - gtk_tree_store_clear(summaryview->store); - gtk_tree_view_set_model(GTK_TREE_VIEW(summaryview->treeview), - GTK_TREE_MODEL(summaryview->store)); + gtkut_tree_view_fast_clear(GTK_TREE_VIEW(summaryview->treeview), + summaryview->store); gtkut_tree_sortable_unset_sort_column_id (GTK_TREE_SORTABLE(summaryview->store)); summaryview->total_size = 0; @@ -5196,10 +5192,8 @@ void summary_qsearch(SummaryView *summaryview) (GSignalMatchType)G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, summaryview); - gtk_tree_view_set_model(GTK_TREE_VIEW(summaryview->treeview), NULL); - gtk_tree_store_clear(summaryview->store); - gtk_tree_view_set_model(GTK_TREE_VIEW(summaryview->treeview), - GTK_TREE_MODEL(summaryview->store)); + gtkut_tree_view_fast_clear(GTK_TREE_VIEW(summaryview->treeview), + summaryview->store); gtkut_tree_sortable_unset_sort_column_id (GTK_TREE_SORTABLE(summaryview->store)); summaryview->total_size = 0; -- cgit v1.2.3