[gnumeric] Conditional Style: fix crash.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Conditional Style: fix crash.
- Date: Wed, 19 Jan 2022 22:22:59 +0000 (UTC)
commit 052c1b11c5177a34ea0e4ccd793fbaa9dba4073e
Author: Morten Welinder <terra gnome org>
Date: Wed Jan 19 17:22:40 2022 -0500
Conditional Style: fix crash.
See #597.
ChangeLog | 5 +++++
NEWS | 1 +
src/mstyle.c | 20 ++++++++++++--------
3 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b99968edd..442e79a63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-19 Morten Welinder <terra gnome org>
+
+ * src/mstyle.c (gnm_style_linked_sheet_changed): Add missing ref.
+ Fixes #597.
+
2022-01-09 Morten Welinder <terra gnome org>
* src/rendered-value.c (gnm_rendered_value_new): Work around Pango
diff --git a/NEWS b/NEWS
index c3d9a9cdb..b1ec6cb07 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Morten:
* Fix inter-gnumeric array formula paste crash. [#606]
* Avoid re-querying file existance for recent files. [Part of #602]
* Fix rich-text rendering (based on work of Jean). [#607]
+ * Fix crash with conditional styling. [#597]
--------------------------------------------------------------------------
Gnumeric 1.12.50
diff --git a/src/mstyle.c b/src/mstyle.c
index c8843f848..e0205907c 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -562,21 +562,22 @@ elem_clear_contents (GnmStyle *style, GnmStyleElement elem)
case MSTYLE_FONT_NAME: go_string_unref (style->font_detail.name); return;
case MSTYLE_FORMAT: go_format_unref (style->format); return;
case MSTYLE_VALIDATION:
- if (style->validation)
+ if (style->validation) {
gnm_validation_unref (style->validation);
+ style->validation = NULL;
+ }
return;
case MSTYLE_HLINK:
- if (style->hlink)
- g_object_unref (style->hlink);
+ g_clear_object (&style->hlink);
return;
case MSTYLE_INPUT_MSG:
- if (style->input_msg)
- g_object_unref (style->input_msg);
+ g_clear_object (&style->input_msg);
return;
case MSTYLE_CONDITIONS:
if (style->conditions) {
clear_conditional_merges (style);
g_object_unref (style->conditions);
+ style->conditions = NULL;
}
return;
default:
@@ -998,7 +999,7 @@ gnm_style_linked_sheet_changed (GnmStyle *style)
new_sc = sheet_conditions_share_conditions_add (new_c);
if (new_sc) {
g_object_unref (new_c);
- new_c = new_sc;
+ new_c = g_object_ref (new_sc);
}
gnm_style_set_conditions (style, new_c);
}
@@ -1006,8 +1007,11 @@ gnm_style_linked_sheet_changed (GnmStyle *style)
/**
* gnm_style_link_sheet:
- * @style: (transfer full):
- * @sheet:
+ * @style: (transfer full): the style for which we need to set the sheet
+ * @sheet: the new sheet
+ *
+ * Returns: (transfer full): new style which may or may not be identical
+ * to the incoming.
*
* ABSORBS a reference to the style and sets the link count to 1.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]