[gnumeric] Fix undo crash related to hyperlinks. [#730466]



commit 17de99affae44254a0a45ed2e97a94999ccea728
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri May 23 01:02:26 2014 -0600

    Fix undo crash related to hyperlinks. [#730466]
    
    2014-05-22  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * src/commands.c (cmd_hyperlink_undo): use posiitons rather than cells
        (cmd_hyperlink_redo): ditto
        (cmd_hyperlink_finalize): ditto
        (cb_cmd_hyperlink_find_cells): ditto

 ChangeLog                    |   14 +++++---------
 NEWS                         |    1 +
 plugins/openoffice/ChangeLog |   13 +++++++++++++
 src/commands.c               |   19 ++++++++++++++-----
 4 files changed, 33 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6b8dd5c..ae7ee8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,16 +1,12 @@
-2014-05-21  Morten Welinder  <terra gnome org>
+2014-05-22  Andreas J. Guelzow <aguelzow pyrshep ca>
 
-       * plugins/openoffice/openoffice-write.c (odf_write_office_styles)
-       (odf_write_graph_styles): Make this much more deterministic.
+       * src/commands.c (cmd_hyperlink_undo): use posiitons rather than cells
+       (cmd_hyperlink_redo): ditto
+       (cmd_hyperlink_finalize): ditto
+       (cb_cmd_hyperlink_find_cells): ditto
 
 2014-05-20  Morten Welinder  <terra gnome org>
 
-       * plugins/openoffice/openoffice-write.c
-       (openoffice_file_save_real): Write graphs and images in order of
-       name, not random hash order.
-       (oo_item_name): New function for naming various styles and objects
-       consistently.
-
        * src/gutils.c (gnm_hash_table_foreach_ordered): New function.
 
        * src/gnm-so-filled.c (gnm_so_filled_write_xml_sax): Don't write
diff --git a/NEWS b/NEWS
index faf34bd..6e6618d 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
        * Fix export of non-ODF interpolation types to ODF.
        * Fix export of titles and subtitles to ODF. [part of #730397]
        * Fix axis sub-element order in ODF export. [part of #730397]
+       * Fix undo crash related to hyperlinks. [#730466]
 
 Morten:
        * Start moving off GtkUIManager.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index f1a9c63..7a7170d 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -3,6 +3,19 @@
        * openoffice-write.c (oo_item_name): provide a sufficient number
        of prefixes
 
+2014-05-21  Morten Welinder  <terra gnome org>
+
+       * openoffice-write.c (odf_write_office_styles)
+       (odf_write_graph_styles): Make this much more deterministic.
+
+2014-05-20  Morten Welinder  <terra gnome org>
+
+       * openoffice-write.c
+       (openoffice_file_save_real): Write graphs and images in order of
+       name, not random hash order.
+       (oo_item_name): New function for naming various styles and objects
+       consistently.
+
 2014-05-19  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_write_axis_full): fix element order
diff --git a/src/commands.c b/src/commands.c
index 16a510b..f4f5b22 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -7225,7 +7225,10 @@ cmd_hyperlink_undo (GnmCommand *cmd,
 
        if (me->opt_content != NULL)
                for (l = me->cells; l; l = l->next) {
-                       GnmCell *cell = l->data;
+                       GnmParsePos *pp = l->data;
+                       GnmCell *cell = sheet_cell_fetch (pp->sheet,
+                                        pp->eval.col,
+                                        pp->eval.row);
                        sheet_cell_set_value (cell, value_new_empty ());
                }
 
@@ -7285,7 +7288,10 @@ cmd_hyperlink_redo (GnmCommand *cmd, WorkbookControl *wbc)
 
        if (me->opt_content != NULL)
                for (l = me->cells; l; l = l->next) {
-                       GnmCell *cell = l->data;
+                       GnmParsePos *pp = l->data;
+                       GnmCell *cell = sheet_cell_fetch (pp->sheet,
+                                        pp->eval.col,
+                                        pp->eval.row);
                        sheet_cell_set_value (cell, value_new_string (me->opt_content));
                }
 
@@ -7328,7 +7334,7 @@ cmd_hyperlink_finalize (GObject *cmd)
 
        g_free (me->opt_content);
 
-       g_slist_free (me->cells);
+       g_slist_free_full (me->cells, g_free);
        me->cells = NULL;
 
        gnm_command_finalize (cmd);
@@ -7346,8 +7352,11 @@ cb_cmd_hyperlink_find_cells (GnmCellIter const *iter, gpointer user)
                                         iter->pp.eval.row);
 
        if (gnm_cell_is_empty (cell) &&
-           !gnm_cell_is_nonsingleton_array (cell))
-               *list = g_slist_prepend (*list, cell);
+           !gnm_cell_is_nonsingleton_array (cell)) {
+               GnmParsePos *pp = g_new (GnmParsePos, 1);
+               parse_pos_init_cell (pp, cell);
+               *list = g_slist_prepend (*list, pp);
+       }
        return NULL;
 }
 


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