GNOME Bugzilla – Bug 658194
Criticals when saving chart as ODF
Last modified: 2011-09-06 08:26:57 UTC
Created attachment 195637 [details] sample file open the attached file and try to save it as an ODF file with foreign elements. You see: (gnumeric:25987): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed ** (gnumeric:25987): CRITICAL **: gog_smoothed_curve_dataset_get_elem: assertion `dim_i == -1' failed ** (gnumeric:25987): CRITICAL **: gog_smoothed_curve_dataset_get_elem: assertion `dim_i == -1' failed The hash_table critical appears as a result of an attempt to determine whether a regression curve or trend line is shown.
How do we try to know if it is a regression curve or a smoothed curve? GOG_IS_REG_CURVE would tell if it is a regression curve. GOG_IS_SMOOTHED_CURVE is the other possible test.
Let's worry about the first warning. We have in openoffice-write.c: ------------------------------------------------------------------ GSList *l, *regressions = gog_object_get_children (series, role); char *str; for (l = regressions; l != NULL && l->data != NULL; l = l->next) { GOData const *bd; GogObject const *regression = l->data; GogObject const *equation = gog_object_get_child_by_name (regression, "Equation"); ... if (equation != NULL) { GObjectClass *klass = G_OBJECT_GET_CLASS (equation); ... ------------------------------------------------------------------ The "(gnumeric:25987): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed" is triggered by the gog_object_get_child_by_name. We ar elater checking whether equation is null, unfortunately we get the critical rather than just a NULL.
The second critical appears in the same code snippet: -------------------------------------------------------------- GSList *l, *regressions = gog_object_get_children (series, role); char *str; for (l = regressions; l != NULL && l->data != NULL; l = l->next) { GOData const *bd; GogObject const *regression = l->data; GogObject const *equation = gog_object_get_child_by_name (regression, "Equation"); str = odf_get_gog_style_name_from_obj (GOG_OBJECT (regression)); gsf_xml_out_start_element (state->xml, (l == regressions) ? CHART "regression-curve" : GNMSTYLE "regression-curve"); gsf_xml_out_add_cstr (state->xml, CHART "style-name", str); if (state->with_extension) { /* Upper and lower bounds */ bd = gog_dataset_get_dim (GOG_DATASET (regression), 0); if (bd != NULL) ... -------------------------------------------------------------- It is triggered by the gog_dataset_get_dim (GOG_DATASET (regression), 0); again a straight NULL would be preferable.
For the last comment, you should never call gog_dataset_get_dim () if you don't know which are the correct indices (this is a feature). gog_dataset_dims() tells which are the first and last that you can use.
Created attachment 195753 [details] [review] Proposed patch Please, test with this patch.
Review of attachment 195753 [details] [review]: please commit
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.