Merge lp:~zorba-coders/zorba/fix-dbedit-parse-xml-segfault into lp:zorba

Proposed by Federico Cavalieri
Status: Merged
Merged at revision: 11682
Proposed branch: lp:~zorba-coders/zorba/fix-dbedit-parse-xml-segfault
Merge into: lp:zorba
Diff against target: 75 lines (+26/-24)
3 files modified
src/store/naive/node_items.cpp (+13/-24)
test/rbkt/ExpQueryResults/zorba/collections/static-edit/static-edit-20.xml.res (+1/-0)
test/rbkt/Queries/zorba/collections/static-edit/static-edit-20.xq (+12/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fix-dbedit-parse-xml-segfault
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Federico Cavalieri Approve
Review via email: mp+199707@code.launchpad.net

Commit message

Fixed db:edit and fn:parse-xml segfault

Description of the change

Fixed db:edit and fn:parse-xml segfault

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/fix-dbedit-parse-xml-segfault/+merge/199707 :
Votes: {'Pending': 1}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/fix-dbedit-parse-xml-segfault/+merge/199707

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu:8180/job/CommitZorba/260/console to view the results.

Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

> Validation queue result for https://code.launchpad.net/~zorba-coders/zorba
> /fix-dbedit-parse-xml-segfault/+merge/199707
>
> Stage "CommitZorba" failed.
>
> Check console output at
> http://jenkins.lambda.nu:8180/job/CommitZorba/260/console to view the results.

review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/store/naive/node_items.cpp'
2--- src/store/naive/node_items.cpp 2013-09-17 21:12:49 +0000
3+++ src/store/naive/node_items.cpp 2013-12-19 19:15:18 +0000
4@@ -798,35 +798,24 @@
5
6 // Before unswapping root nodes as well, their references in the type maps
7 // must be erased.
8- store::Item_t lRootNodeType;
9- store::Item_t lOtherRootNodeType;
10- bool lRootHasType = getTree()->theTypesMap->get(
11- getTree()->theRootNode, lRootNodeType);
12- bool lOtherRootHasType = lOtherItem->getTree()->theTypesMap->get(
13- lOtherItem->getTree()->theRootNode, lOtherRootNodeType);
14- if(lRootHasType)
15- {
16- getTree()->theTypesMap->erase(getTree()->theRootNode);
17- }
18- if(lOtherRootHasType)
19- {
20- lOtherItem->getTree()->theTypesMap->erase(
21- lOtherItem->getTree()->theRootNode);
22- }
23+ store::Item_t lRootNodeType = getTree()->getType(getTree()->theRootNode);
24+ store::Item_t lOtherRootNodeType = lOtherItem->getTree()->getType(
25+ lOtherItem->getTree()->theRootNode);
26+
27+ if (lRootNodeType != NULL)
28+ getTree()->removeType(getTree()->theRootNode);
29+ if (lOtherRootNodeType != NULL)
30+ lOtherItem->getTree()->removeType(lOtherItem->getTree()->theRootNode);
31
32 // Now unswapping root nodes.
33 std::swap(getTree()->theRootNode, lOtherItem->getTree()->theRootNode);
34
35 // And putting references back into the type maps.
36- if(lRootHasType)
37- {
38- getTree()->theTypesMap->insert(getTree()->theRootNode, lRootNodeType);
39- }
40- if(lOtherRootHasType)
41- {
42- lOtherItem->getTree()->theTypesMap->insert(
43- lOtherItem->getTree()->theRootNode, lOtherRootNodeType);
44- }
45+ if (lRootNodeType != NULL)
46+ getTree()->addType(getTree()->theRootNode, lRootNodeType);
47+ if (lOtherRootNodeType != NULL)
48+ lOtherItem->getTree()->addType(lOtherItem->getTree()->theRootNode,
49+ lOtherRootNodeType);
50
51 // Swap flags expect hasReference.
52 bool lHasReference = haveReference();
53
54=== added file 'test/rbkt/ExpQueryResults/zorba/collections/static-edit/static-edit-20.xml.res'
55--- test/rbkt/ExpQueryResults/zorba/collections/static-edit/static-edit-20.xml.res 1970-01-01 00:00:00 +0000
56+++ test/rbkt/ExpQueryResults/zorba/collections/static-edit/static-edit-20.xml.res 2013-12-19 19:15:18 +0000
57@@ -0,0 +1,1 @@
58+<a/><d/><c/>
59
60=== added file 'test/rbkt/Queries/zorba/collections/static-edit/static-edit-20.xq'
61--- test/rbkt/Queries/zorba/collections/static-edit/static-edit-20.xq 1970-01-01 00:00:00 +0000
62+++ test/rbkt/Queries/zorba/collections/static-edit/static-edit-20.xq 2013-12-19 19:15:18 +0000
63@@ -0,0 +1,12 @@
64+import module namespace ddl = "http://zorba.io/modules/store/static/collections/ddl";
65+import module namespace dml = "http://zorba.io/modules/store/static/collections/dml";
66+
67+import module namespace ns = "http://www.example.com/example" at "../collection_001.xqdata";
68+
69+ddl:create(xs:QName("ns:collection"));
70+
71+dml:insert(xs:QName("ns:collection"), (<a/>, <b/>, <c/>));
72+
73+dml:edit(dml:collection(xs:QName("ns:collection"))[2], parse-xml("<d/>")/*);
74+
75+dml:collection(xs:QName("ns:collection"))

Subscribers

People subscribed via source and target branches