dr78: #i26822# remove draw shell if selected object is removed by undo
[LibreOffice.git] / libxml2 / libxml2-xpath.patch
blob107de91ed8627a925db07039f85e3e6ff44e6411
1 --- misc/libxml2-2.7.6/xpath.c 2009-09-24 17:32:00.000000000 +0200
2 +++ misc/build/libxml2-2.7.6/xpath.c 2011-01-03 17:21:08.788256100 +0100
3 @@ -8106,9 +8106,17 @@
4 xmlNodePtr
5 xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
6 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
7 - if (cur != NULL && cur->children != NULL)
8 - return cur->children ;
9 - if (cur == NULL) cur = ctxt->context->node;
10 + if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) &&
11 + (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))
12 + return(cur->children);
14 + if (cur == NULL) {
15 + cur = ctxt->context->node;
16 + if (cur->type == XML_NAMESPACE_DECL)
17 + return(NULL);
18 + if (cur->type == XML_ATTRIBUTE_NODE)
19 + cur = cur->parent;
20 + }
21 if (cur == NULL) return(NULL) ; /* ERROR */
22 if (cur->next != NULL) return(cur->next) ;
23 do {
24 @@ -8162,8 +8170,13 @@
25 xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
27 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
28 - if (cur == NULL)
29 + if (cur == NULL) {
30 cur = ctxt->context->node;
31 + if (cur->type == XML_NAMESPACE_DECL)
32 + return(NULL);
33 + if (cur->type == XML_ATTRIBUTE_NODE)
34 + return(cur->parent);
35 + }
36 if (cur == NULL)
37 return (NULL);
38 if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
39 @@ -8207,8 +8220,8 @@
40 cur = ctxt->context->node;
41 if (cur == NULL)
42 return (NULL);
43 - if (cur->type == XML_NAMESPACE_DECL)
44 - cur = (xmlNodePtr)((xmlNsPtr)cur)->next;
45 + if (cur->type == XML_NAMESPACE_DECL)
46 + return (NULL);
47 ctxt->ancestor = cur->parent;
49 if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
50 @@ -11737,11 +11750,16 @@
52 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
53 xmlXPathObjectPtr tmp;
54 - /* pop the result */
55 + /* pop the result if any */
56 tmp = valuePop(ctxt);
57 - xmlXPathReleaseObject(xpctxt, tmp);
58 - /* then pop off contextObj, which will be freed later */
59 - valuePop(ctxt);
60 + if (tmp != contextObj) {
61 + /*
62 + * Free up the result
63 + * then pop off contextObj, which will be freed later
64 + */
65 + xmlXPathReleaseObject(xpctxt, tmp);
66 + valuePop(ctxt);
67 + }
68 goto evaluation_error;