aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-12-04 17:59:31 +0800
committerChris Toshok <toshok@src.gnome.org>2000-12-04 17:59:31 +0800
commitb7efb0befa9d8b141c4ddac54c194bc4f94f4134 (patch)
treefcf70768172de02eedb55d043a0f6f0332218ed4 /widgets
parent8ee09aa6bda9c725845978627b5682efc467f53e (diff)
downloadgsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar.gz
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar.bz2
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar.lz
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar.xz
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.tar.zst
gsoc2013-evolution-b7efb0befa9d8b141c4ddac54c194bc4f94f4134.zip
need to zero out the bits corresponding to the rows not selected in the
2000-12-04 Chris Toshok <toshok@helixcode.com> * e-table-selection-model.c (e_table_selection_model_select_all): need to zero out the bits corresponding to the rows not selected in the last full 32 bit mask. This fixes a crash in the subscribe UI (or potentially anywhere that uses selection_model_select_all/selection_model_foreach.) svn path=/trunk/; revision=6770
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-selection-model.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index e8f5dcd38f..d39e7b3c14 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -524,7 +524,19 @@ e_table_selection_model_select_all (ETableSelectionModel *selection)
for (i = 0; i < (selection->row_count + 31) / 32; i ++) {
selection->selection[i] = ONES;
}
-
+
+ /* need to zero out the bits corresponding to the rows not
+ selected in the last full 32 bit mask */
+ if (selection->row_count % 32) {
+ int unselected_mask = 0;
+ int num_unselected_in_last_byte = 32 - selection->row_count % 32;
+
+ for (i = 0; i < num_unselected_in_last_byte; i ++)
+ unselected_mask |= 1 << i;
+
+ selection->selection[(selection->row_count + 31) / 32 - 1] &= ~unselected_mask;
+ }
+
selection->cursor_col = 0;
selection->cursor_row = 0;
selection->selection_start_row = 0;