gnumeric r16988 - in trunk: . src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16988 - in trunk: . src
- Date: Thu, 4 Dec 2008 16:03:20 +0000 (UTC)
Author: mortenw
Date: Thu Dec 4 16:03:20 2008
New Revision: 16988
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16988&view=rev
Log:
2008-12-04 Morten Welinder <terra gnome org>
* src/xml-sax-write.c (gnm_cellregion_to_xml): Set state.sheet so
we can init parse positions later.
* src/xml-io.c (xml_cellregion_read): Copy the string. It need
not be null terminated. Assign ctxt->sheet.
(xml_read_sheet_object): New argument, assign, to explicitly
control whether to assign the object to the sheet. Fixes #556561.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/src/xml-io.c
trunk/src/xml-sax-write.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Dec 4 16:03:20 2008
@@ -46,6 +46,7 @@
* Merge the sheet tabs into the status bar. [#561733]
* Fix crash in multi-view mode. [#562053]
* Introduce explicit () on parsing -2^2. [#115941]
+ * Fix inter-process paste crash. [#556561]
--------------------------------------------------------------------------
Gnumeric 1.9.3
Modified: trunk/src/xml-io.c
==============================================================================
--- trunk/src/xml-io.c (original)
+++ trunk/src/xml-io.c Thu Dec 4 16:03:20 2008
@@ -1647,7 +1647,8 @@
}
static SheetObject *
-xml_read_sheet_object (XmlParseContext const *ctxt, xmlNodePtr tree)
+xml_read_sheet_object (XmlParseContext const *ctxt, xmlNodePtr tree,
+ Sheet *sheet)
{
char *tmp;
int tmp_int;
@@ -1747,8 +1748,8 @@
so->anchor.base.direction = GOD_ANCHOR_DIR_UNKNOWN;
/* Do not assign to a sheet when extracting a cell region */
- if (NULL != ctxt->sheet) {
- sheet_object_set_sheet (so, ctxt->sheet);
+ if (sheet) {
+ sheet_object_set_sheet (so, sheet);
g_object_unref (G_OBJECT (so));
}
return so;
@@ -1990,7 +1991,7 @@
xmlNodePtr object = child->xmlChildrenNode;
for (; object != NULL ; object = object->next)
if (!xmlIsBlankNode (object))
- xml_read_sheet_object (ctxt, object);
+ xml_read_sheet_object (ctxt, object, ctxt->sheet);
}
child = e_xml_get_child_by_name (tree, CC2XML ("Cells"));
@@ -2142,12 +2143,15 @@
GnmLocale *locale;
int dummy;
xmlChar *dateconvstr;
+ char *buffer_copy;
g_return_val_if_fail (buffer != NULL, NULL);
locale = gnm_push_C_locale ();
- doc = xmlParseDoc (CC2XML (buffer));
+ buffer_copy = g_strndup (buffer, length);
+ doc = xmlParseDoc (CC2XML (buffer_copy));
+ g_free (buffer_copy);
if (doc == NULL) {
go_cmd_context_error_import (GO_CMD_CONTEXT (wbc),
@@ -2162,10 +2166,10 @@
goto err;
}
- /* ctxt->sheet must == NULL or copying objects will break */
ctxt = xml_parse_ctx_new (doc, NULL, NULL);
- cr = cellregion_new (NULL);
+ ctxt->sheet = sheet;
+ cr = cellregion_new (NULL);
xml_node_get_int (clipboard, "Cols", &cr->cols);
xml_node_get_int (clipboard, "Rows", &cr->rows);
xml_node_get_int (clipboard, "BaseCol", &cr->base.col);
@@ -2214,7 +2218,7 @@
for (l = l->xmlChildrenNode; l != NULL ; l = l->next)
if (!xmlIsBlankNode (l))
cr->objects = g_slist_prepend (cr->objects,
- xml_read_sheet_object (ctxt, l));
+ xml_read_sheet_object (ctxt, l, NULL));
xml_parse_ctx_destroy (ctxt);
xmlFreeDoc (doc);
Modified: trunk/src/xml-sax-write.c
==============================================================================
--- trunk/src/xml-sax-write.c (original)
+++ trunk/src/xml-sax-write.c Thu Dec 4 16:03:20 2008
@@ -402,10 +402,7 @@
GnmInputMsg const *im;
GnmStyleConditions const *sc;
GnmStyleCond const *cond;
- GnmBorder const *border;
GnmStyleBorderType t;
- GnmParsePos pp;
- char *tmp;
unsigned i;
gboolean started;
@@ -485,6 +482,9 @@
if (gnm_style_is_element_set (style, MSTYLE_VALIDATION) &&
NULL != (v = gnm_style_get_validation (style))) {
+ GnmParsePos pp;
+ char *tmp;
+
gsf_xml_out_start_element (state->output, GNM "Validation");
gsf_xml_out_add_int (state->output, "Style", v->style);
gsf_xml_out_add_int (state->output, "Type", v->type);
@@ -510,6 +510,7 @@
gsf_xml_out_add_cstr (state->output, "Message", v->msg->str);
parse_pos_init_sheet (&pp, (Sheet *)state->sheet);
+
if (v->texpr[0] != NULL &&
(tmp = gnm_expr_top_as_string (v->texpr[0], &pp, state->convs)) != NULL) {
gsf_xml_out_simple_element (state->output, GNM "Expression0", tmp);
@@ -537,12 +538,15 @@
if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS) &&
NULL != (sc = gnm_style_get_conditions (style))) {
GArray const *conds = gnm_style_conditions_details (sc);
- if (conds != NULL)
+ if (conds != NULL) {
+ char *tmp;
+ GnmParsePos pp;
+ parse_pos_init_sheet (&pp, (Sheet *)state->sheet);
+
for (i = 0 ; i < conds->len ; i++) {
cond = &g_array_index (conds, GnmStyleCond, i);
gsf_xml_out_start_element (state->output, GNM "Condition");
gsf_xml_out_add_int (state->output, "Operator", cond->op);
- parse_pos_init_sheet (&pp, (Sheet *)state->sheet);
if (cond->texpr[0] != NULL &&
(tmp = gnm_expr_top_as_string (cond->texpr[0], &pp, state->convs)) != NULL) {
gsf_xml_out_simple_element (state->output, GNM "Expression0", tmp);
@@ -556,10 +560,12 @@
xml_write_style (state, cond->overlay);
gsf_xml_out_end_element (state->output); /* </Condition> */
}
+ }
}
started = FALSE;
- for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_DIAGONAL; i++)
+ for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_DIAGONAL; i++) {
+ GnmBorder const *border;
if (gnm_style_is_element_set (style, i) &&
NULL != (border = gnm_style_get_border (style, i)) &&
GNM_STYLE_BORDER_NONE != (t = border->line_type)) {
@@ -576,6 +582,7 @@
gnm_xml_out_add_color (state->output, "Color", col);
gsf_xml_out_end_element (state->output);
}
+ }
if (started)
gsf_xml_out_end_element (state->output);
@@ -1357,7 +1364,7 @@
state.state.wb_view = NULL;
state.state.wb = NULL;
- state.state.sheet = NULL;
+ state.state.sheet = cr->origin_sheet;
state.state.output = gsf_xml_out_new (buf);
state.state.convs = gnm_xml_io_conventions ();
state.state.expr_map = g_hash_table_new (g_direct_hash, g_direct_equal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]