[gnumeric] Names: fix inter-process paste crash related to sheet-local names.



commit 8a195f7720ac31061719b5d0a55d42fa5d61fa91
Author: Morten Welinder <terra gnome org>
Date:   Wed Jun 29 10:22:11 2016 -0400

    Names: fix inter-process paste crash related to sheet-local names.

 ChangeLog        |    5 +++++
 NEWS             |    1 +
 src/parse-util.c |    7 +++++--
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3f7392..5e6e43a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-29  Morten Welinder  <terra gnome org>
+
+       * src/parse-util.c (std_expr_name_handler): Fix workbook confusion
+       related to sheet-local names.  [#768164]
+
 2016-06-28  Morten Welinder  <terra gnome org>
 
        * src/stf-parse.c (stf_parse_options_guess_formats): Handle lines
diff --git a/NEWS b/NEWS
index f32ec89..75a3a52 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Morten:
        * Fix case issues for database functions.
        * Anchor COUNTIF criteria at end too.
        * Add tests for COUNTIF.
+       * Fix inter-process paste crash.  [#768164]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.30
diff --git a/src/parse-util.c b/src/parse-util.c
index 42c0101..f9cb11f 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -1271,8 +1271,11 @@ std_expr_name_handler (GnmConventionsOut *out, GnmExprName const *name)
        }
 
        if (name->optional_scope != NULL) {
-               if (name->optional_scope->workbook != out->pp->wb) {
-                       char *rel_uri = wb_rel_uri (name->optional_wb_scope, out->pp->wb);
+               Workbook *out_wb = out->pp->wb
+                       ? out->pp->wb
+                       : out->pp->sheet->workbook;
+               if (name->optional_scope->workbook != out_wb) {
+                       char *rel_uri = wb_rel_uri (name->optional_scope->workbook, out_wb);
                        g_string_append_c (target, '[');
                        g_string_append (target, rel_uri);
                        g_string_append_c (target, ']');


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