[gnumeric] Cond format: fix crash with "copy" button in gui.



commit 2a3d9295fcbb65bceebc7c95d6867408eb4b4563
Author: Morten Welinder <terra gnome org>
Date:   Thu Jul 12 11:10:02 2018 -0400

    Cond format: fix crash with "copy" button in gui.

 ChangeLog    | 5 +++++
 NEWS         | 1 +
 src/mstyle.c | 7 ++++---
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9e827f2f4..5e5287816 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-12  Morten Welinder  <terra gnome org>
+
+       * src/mstyle.c (gnm_style_get_cond_style): Update the cached
+       styles as needed.  Fixes #343.
+
 2018-06-08  Morten Welinder  <terra gnome org>
 
        * src/xml-sax-write.c (gnm_cellregion_to_xml): Impose ordering on
diff --git a/NEWS b/NEWS
index 70c63dd5b..bd8bef8a1 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Morten:
        * Don't save any configuration when running ssconvert/ssdiff/...
        * Turn GnmFunc into a GObject.
        * Make clipboard output deterministic.
+       * Fix conditional format crash [#343].
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.41
diff --git a/src/mstyle.c b/src/mstyle.c
index a114c07a7..51d70a315 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -2303,15 +2303,16 @@ gnm_style_get_cond_style (GnmStyle const *style, int ix)
 {
        g_return_val_if_fail (style != NULL, NULL);
        g_return_val_if_fail (elem_is_set (style, MSTYLE_CONDITIONS), NULL);
-       g_return_val_if_fail (style->cond_styles != NULL, NULL);
+       g_return_val_if_fail (style->conditions != NULL, NULL);
+       g_return_val_if_fail (ix >= 0 && (unsigned)ix < gnm_style_conditions_details 
(style->conditions)->len, NULL);
 
-       g_return_val_if_fail (ix >= 0 && (unsigned)ix < style->cond_styles->len, NULL);
+       if (style->changed)
+               gnm_style_update ((GnmStyle *)style);
 
        return g_ptr_array_index (style->cond_styles, ix);
 }
 
 
-
 static gboolean
 debug_style_deps (void)
 {


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