[gnumeric] GUI: Avoid crashing because the gui allowed line number 0.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Avoid crashing because the gui allowed line number 0.
- Date: Tue, 22 Mar 2011 17:39:28 +0000 (UTC)
commit d273fd1c09a75e0ea48c059cd4dae40858bfc71a
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 22 13:39:03 2011 -0400
GUI: Avoid crashing because the gui allowed line number 0.
NEWS | 1 +
src/dialogs/ChangeLog | 7 ++++++-
src/dialogs/dialog-stf-main-page.c | 14 ++++++--------
3 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8aef202..0af3813 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,7 @@ Morten:
* Improve quit dialog's non-ascii handling. [#644982]
* Make print-preview work on win32 by avoiding gtk+. [#533795]
* Fix crash related to dynamic deps. [#645209]
+ * Fix stf import crash. [#645555]
Stanley Pinchak:
* Improve "dif" output.
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 7775ca9..2bded14 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-22 Morten Welinder <terra gnome org>
+
+ * dialog-stf-main-page.c (main_page_import_range_changed): Avoid
+ line number 0 issue including crash #645555.
+
2011-03-17 Morten Welinder <terra gnome org>
* dialog-quit.c (url_renderer_func): Decode URIs before display.
@@ -8,7 +13,7 @@
* cell-format.ui: formulas -> formulæ
* dao.ui: ditto
* paste-special.ui: ditto
-
+
2011-03-08 Morten Welinder <terra gnome org>
* dialog-doc-metadata.c (dialog_doc_metadata_transform_timestamp_to_str):
diff --git a/src/dialogs/dialog-stf-main-page.c b/src/dialogs/dialog-stf-main-page.c
index b4fed74..eb6d4ee 100644
--- a/src/dialogs/dialog-stf-main-page.c
+++ b/src/dialogs/dialog-stf-main-page.c
@@ -143,19 +143,17 @@ main_page_import_range_changed (StfDialogData *data)
startrow = gtk_spin_button_get_value_as_int (data->main.main_startrow);
stoprow = gtk_spin_button_get_value_as_int (data->main.main_stoprow);
- if (startrow > stoprow) {
- startrow = stoprow;
- gtk_spin_button_set_value (data->main.main_startrow, startrow);
- }
+ stoprow = MAX (1, stoprow);
+ startrow = MIN (stoprow, MAX (1, startrow));
stoplimit = MIN ((int)renderdata->lines->len,
startrow + (GNM_MAX_ROWS - 1));
- if (stoprow > stoplimit) {
- stoprow = stoplimit;
- gtk_spin_button_set_value (data->main.main_stoprow, stoprow);
- }
+ stoprow = MIN (stoprow, stoplimit);
+ gtk_spin_button_set_value (data->main.main_startrow, startrow);
main_page_set_spin_button_adjustment (data->main.main_startrow, 1, stoprow);
+
+ gtk_spin_button_set_value (data->main.main_stoprow, stoprow);
main_page_set_spin_button_adjustment (data->main.main_stoprow, startrow, stoplimit);
data->cur = stf_parse_find_line (data->parseoptions, data->utf8_data, startrow - 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]