[gnumeric] TABLE: Fix FMR when the same cell is used twice.



commit e2cb668e195d2561a73301ddb1e217f68d140e9e
Author: Morten Welinder <terra gnome org>
Date:   Mon Jul 6 20:24:39 2015 -0400

    TABLE: Fix FMR when the same cell is used twice.

 ChangeLog          |    4 ++++
 NEWS               |    2 +-
 src/func-builtin.c |   12 +++++++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7354eaf..5454ec7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-06  Morten Welinder  <terra gnome org>
+
+       * src/func-builtin.c (gnumeric_table): Avoid FMR.  Fixes #752021.
+
 2015-07-05  Jean Brefort  <jean brefort normalesup org>
 
        * src/sheet-object-graph.c (vector_end): fix array overflow. [#751971]
diff --git a/NEWS b/NEWS
index 722e321..263d129 100644
--- a/NEWS
+++ b/NEWS
@@ -33,7 +33,7 @@ Morten:
          [#750811] [#750810] [#750857] [#750864] [#750862] [#750858]
          [#751126] [#751254] [#751253] [#750851] [#751258] [#751259]
          [#751502] [#751390] [#751579] [#751659] [#751660] [#751662]
-         [#751970] [#752022] [#751988]
+         [#751970] [#752022] [#751988] [#752021]
        * Make solver check linearity of model.
        * Fix xls saving of marker style.  [#749185]
        * Make compilation with clang work again.  [#749138]
diff --git a/src/func-builtin.c b/src/func-builtin.c
index c47b214..10b27dd 100644
--- a/src/func-builtin.c
+++ b/src/func-builtin.c
@@ -250,7 +250,15 @@ gnumeric_table (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
                    !gnm_cell_expr_is_linked (in[x]))
                        dependent_link (&in[x]->base);
 
-       for (x = 0 ; x < 3 ; x++)
+       for (x = 0 ; x < 3 ; x++) {
+               int y;
+               for (y = x + 1; y < 3; y++) {
+                       if (in[x] == in[y]) {
+                               in[y] = NULL;
+                               break;
+                       }
+               }
+
                if (in[x]) {
                        dependent_queue_recalc (&in[x]->base);
 
@@ -261,6 +269,8 @@ gnumeric_table (GnmFuncEvalInfo *ei, int argc, GnmExprConstPtr const *argv)
                        }
                        gnm_app_recalc_clear_caches ();
                }
+       }
+
        for (x = 0 ; x < 3 ; x++)
                if (in[x])
                        gnm_cell_eval (in[x]);


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