aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-selection-model-array.c7
-rw-r--r--widgets/misc/e-selection-model-simple.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
index dd81fb2554..2ed1f0a6be 100644
--- a/widgets/misc/e-selection-model-array.c
+++ b/widgets/misc/e-selection-model-array.c
@@ -44,6 +44,8 @@ e_selection_model_array_confirm_row_count(ESelectionModelArray *esma)
if (esma->eba == NULL) {
int row_count = e_selection_model_array_get_row_count(esma);
esma->eba = e_bit_array_new(row_count);
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
}
}
@@ -384,10 +386,11 @@ esma_real_select_single_row (ESelectionModel *selection, int row)
static void
esma_select_single_row (ESelectionModel *selection, int row)
{
- int selected_row = E_SELECTION_MODEL_ARRAY(selection)->selected_row;
+ ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
+ int selected_row = esma->selected_row;
esma_real_select_single_row (selection, row);
- if (selected_row != -1) {
+ if (selected_row != -1 && esma->eba && selected_row < e_bit_array_bit_count (esma->eba)) {
if (selected_row != row) {
e_selection_model_selection_row_changed(selection, selected_row);
e_selection_model_selection_row_changed(selection, row);
diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c
index b35ac7d497..0d87cdc779 100644
--- a/widgets/misc/e-selection-model-simple.c
+++ b/widgets/misc/e-selection-model-simple.c
@@ -77,6 +77,8 @@ e_selection_model_simple_set_row_count (ESelectionModelSimple *esms,
if (esma->eba)
gtk_object_unref(GTK_OBJECT(esma->eba));
esma->eba = NULL;
+ esma->selected_row = -1;
+ esma->selected_range_end = -1;
}
esms->row_count = row_count;
}