[gdome]cvs version segfault: unref doc before element
- From: "T.J. Mather" <tjmather tjmather com>
- To: gdome gnome org
- Subject: [gdome]cvs version segfault: unref doc before element
- Date: Sun, 28 Oct 2001 18:14:29 -0500 (EST)
I've run into a problem with the new memory management functions.
Decreasing the reference count of the document node before one of its
elements results in a segmentation fault. Here's a program that
illustrates the problem:
#include <gdome.h>
int main (int argc, char **argv) {
GdomeDOMImplementation *domimpl = gdome_di_mkref ();
GdomeDOMString *name = gdome_str_mkref ("TEST");
GdomeException exc = 0;
GdomeDocument *doc = gdome_di_createDocument(domimpl, NULL, name, NULL, &exc);
GdomeElement *root = gdome_doc_documentElement (doc, &exc);
gdome_doc_unref (doc, &exc); /* DOC unref */
gdome_el_unref(root, &exc); /* Element unref */
gdome_di_unref (domimpl, &exc);
return 0;
}
If the doc_unref line comes after the el_unref line instead of before,
then the program works properly.
I'm not sure if this is a feature request or a bug report, but it would be
handy to be able to decrement the ref counts in any order.
I'm working on XML::GDOME, a perl wrapper for gdome, and would like to
call unref every time the Perl wrapper object is freed, but I cannot
guarantee the order in which the Perl objects are freed.
Thanks,
TJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]