Re: Question gdome test program
Luca Padovani <[email protected]> Tue, 23 Dec 2003 11:12:34 +0100
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Message-ID | <1072174354.524.20.camel@localhost> |
Hi, On Tue, 2003-12-23 at 09:54, [email protected] wrote: > I compile gdome using VC. > And meet a problem when running \test\bench.c > > it is broken down in traversal() > because the ownerDoc is NULL after call gdome_xml_n_unref the test works for me. However I see a problem for sure which is the domdoc variable has type GdomeDocument but it is casted to GdomeElement for the first call to traversal! For some gdome2 magic this should cause no harm but anyway I've corrected the code in CVS (see patch attached). In case you're still experiencing the problem (likely), would you be able to generate a stack trace? Cheers, -- luca
d
(text/x-patch, 1.4 KB)
Index: bench.c
===================================================================
RCS file: /cvs/gnome/gdome2/test/bench.c,v
retrieving revision 1.3
diff -r1.3 bench.c
66c66
< void traversal (GdomeElement *el) {
---
> void traversal (GdomeNode *n) {
72,78c72,77
< child = gdome_el_firstChild (el, &exc);
<
< while(child) {
< type = gdome_n_nodeType (child, &exc);
< switch (type) {
< case GDOME_ELEMENT_NODE:
< printElHead ((GdomeElement *)child);
---
> type = gdome_n_nodeType (n, &exc);
> switch (type) {
> case GDOME_ELEMENT_NODE:
> printElHead ((GdomeElement *)n);
> child = gdome_n_firstChild (n, &exc);
> while(child) {
80,86c79,81
< printElFoot ((GdomeElement *)child);
< break;
< case GDOME_TEXT_NODE:
< str = gdome_t_data ((GdomeText *)child, &exc);
< printf (str->str);
< gdome_str_unref (str);
< break;
---
> temp = gdome_n_nextSibling (child, &exc);
> gdome_n_unref (child, &exc);
> child = temp;
88,90c83,89
< temp = gdome_n_nextSibling (child, &exc);
< gdome_n_unref (child, &exc);
< child = temp;
---
> printElFoot ((GdomeElement *)n);
> break;
> case GDOME_TEXT_NODE:
> str = gdome_t_data ((GdomeText *)n, &exc);
> printf (str->str);
> gdome_str_unref (str);
> break;
91a91
>
96a97
> GdomeElement* root;
111,112c112,114
< traversal ((GdomeElement *)domdoc);
<
---
> root = gdome_doc_documentElement(domdoc, &exc);
> traversal ((GdomeNode*) root);
> gdome_el_unref(root, &exc);