[gdome]bug in gdome_xml_n_mkref



Hi everybody,

funnily enough, the method mentioned in the subject, which is one of the
most heavily used, seems to be bugged.

File: gdome-xml-node.c, line 167.

Scenario:
1) get a document, thus we have a GdomeDocument* wrapper allocated. This
wrapper has refcount == 1 and livenodes == 1.
2) get the root element of the document. livenodes in the document
wrapper goes to 2.
3) unref the document wrapper. Its refcount falls to 0 and the livenodes
field falls to 1, but the document wrapper is not deallocated 'cause the
livenodes field is still non-zero (see gdome-xml-document.c and
gdome-treegc.c)
4) ask for the parent of the root element. Its parent is the document
wrapper, so the refcounter in the document wrapper goes to 1 (see
gdome-xml-node.c) but the livenodes fiels stays at 1!

Next time a node is unreffed the document wrapper goes away, the
document is freed even though there are still live wrappers around.

Why has the livenodes field to account for the document wrapper as well?
I don't remember...

If you all agree with my diagnosis I'll try a patch shortly.

Cheers,
--luca

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]