[gnumeric] xlsx: fix crash on export with certain shared strings.



commit 10f696755ff33dafb7189998a5b493ecd2ea0a90
Author: Morten Welinder <terra gnome org>
Date:   Sun Apr 26 12:05:29 2015 -0400

    xlsx: fix crash on export with certain shared strings.

 NEWS                       |    1 +
 plugins/excel/ChangeLog    |    5 +++++
 plugins/excel/xlsx-write.c |   15 +++++++++------
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 06714bd..5a69b7e 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Morten:
        * Fix import/export of graph backplane.
        * Fix export of unlabelled axes.
        * Fix export of rotated axis labels.
+       * Fix xlsx save crash related to shared strings.  [#748477]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.22
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 55f60f2..2c2ee96 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-26  Morten Welinder  <terra gnome org>
+
+       * xlsx-write.c (xlsx_shared_string): Retry hash lookup when we
+       clear the format.
+
 2015-04-24  Morten Welinder  <terra gnome org>
 
        * xlsx-write-drawing.c (xlsx_write_go_style_full): Export
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index c589087..62e2358 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -473,13 +473,16 @@ xlsx_shared_string (XLSXWriteState *state, GnmValue const *v)
        else {
                GnmValue *v2 = value_dup (v);
 
-               if (VALUE_FMT (v2) && !go_format_is_markup (VALUE_FMT (v2)))
+               if (VALUE_FMT (v2) && !go_format_is_markup (VALUE_FMT (v2))) {
                        value_set_fmt (v2, NULL);
-
-               i = state->shared_string_array->len;
-               g_ptr_array_add (state->shared_string_array, v2);
-               g_hash_table_insert (state->shared_string_hash,
-                                    v2, GINT_TO_POINTER (i));
+                       i = xlsx_shared_string (state, v2);
+                       value_release (v2);
+               } else {
+                       i = state->shared_string_array->len;
+                       g_ptr_array_add (state->shared_string_array, v2);
+                       g_hash_table_insert (state->shared_string_hash,
+                                            v2, GINT_TO_POINTER (i));
+               }
        }
 
        return i;


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