[gnumeric] Fix crash on exit.



commit 0fbd38cc6b55cfd93698053d0b2cc98947027efd
Author: Morten Welinder <terra gnome org>
Date:   Mon May 21 10:43:09 2018 -0400

    Fix crash on exit.
    
    This happened with an active region.

 NEWS         |    1 +
 src/gutils.c |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index df5a5a6..41f0bf4 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Morten:
        * ssconvert improvements.
        * Makefile improvements.
        * Don't save any configuration when running ssconvert/ssdiff/...
+       * Fix crash-on-exit.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.41
diff --git a/src/gutils.c b/src/gutils.c
index 4a4d01c..40cefcc 100644
--- a/src/gutils.c
+++ b/src/gutils.c
@@ -892,7 +892,7 @@ gnm_file_saver_get_sheet (GOFileSaver const *fs, WorkbookView const *wbv)
  * @default_all: If %TRUE, all sheets will be selected by default; if %FALSE,
  * this function will return %NULL if no sheets were explicitly selected.
  *
- * For a workbook-scope saver, this function determines what sheets to save.
+ * This function determines what sheets to save.
  *
  * Returns: (transfer container) (element-type Sheet): the sheets to export
  *
@@ -905,12 +905,12 @@ gnm_file_saver_get_sheets (GOFileSaver const *fs,
 {
        Workbook *wb;
        GPtrArray *sel, *sheets;
+       GOFileSaveScope save_scope;
 
        g_return_val_if_fail (GO_IS_FILE_SAVER (fs), NULL);
-       g_return_val_if_fail (go_file_saver_get_save_scope (fs) ==
-                             GO_FILE_SAVE_WORKBOOK, NULL);
        g_return_val_if_fail (GNM_IS_WORKBOOK_VIEW (wbv), NULL);
 
+       save_scope = go_file_saver_get_save_scope (fs);
        wb = wb_view_get_workbook (wbv);
        sel = g_object_get_data (G_OBJECT (wb), SHEET_SELECTION_KEY);
        sheets = g_object_get_data (G_OBJECT (wb), SSCONVERT_SHEET_SET_KEY);
@@ -918,7 +918,10 @@ gnm_file_saver_get_sheets (GOFileSaver const *fs,
                g_ptr_array_ref (sel);
        else if (sheets)
                sel = g_ptr_array_ref (sheets);
-       else if (default_all) {
+       else if (save_scope != GO_FILE_SAVE_WORKBOOK) {
+               sel = g_ptr_array_new ();
+               g_ptr_array_add (sel, wb_view_cur_sheet (wbv));
+       } else if (default_all) {
                int i;
                sel = g_ptr_array_new ();
                for (i = 0; i < workbook_sheet_count (wb); i++) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]