summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-09-01 18:07:23 +0000
committerStef Walter <stef@memberwebs.com>2004-09-01 18:07:23 +0000
commit545348b5c62da57f69b857a2ed323cf8847aedf2 (patch)
tree1aa69094c6ced0787ab9f7a02930d018d5ef2bef
parente1622ec1957dba431a0df1133833984522ad1118 (diff)
Fix problems with reference counting
-rw-r--r--ChangeLog4
-rw-r--r--src/domcxx.h29
2 files changed, 20 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index ccb83ff..e5e2102 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
-Version 1.0
+Version 0.9.4
- Switched from Sablotron to DOMC (due to speed and dependency issues)
- Added support for ANSI to Unicode conversions
+ - Fixes to DOMC for speed on large node lists
+ - Other bug fixes
Version 0.9.3
- Code cleanup and commenting
diff --git a/src/domcxx.h b/src/domcxx.h
index 9ebc023..abdd622 100644
--- a/src/domcxx.h
+++ b/src/domcxx.h
@@ -141,9 +141,9 @@ namespace DOM
/* We only perform ref counting on nodes outside the tree */
#define INC_NODE_REF(n) \
- if(LOOSE_NODE(n)) incref(n)
+ if(n) incref(n)
#define DEC_NODE_REF(n) \
- if(LOOSE_NODE(n)) decref(n)
+ if(n) decref(n)
/**
* Thin wrapper class for a DOM Node
@@ -440,13 +440,16 @@ namespace DOM
inline void decref(DOM_Node* node)
{
ASSERT(node);
- ASSERT(node->parentNode == NULL);
--(node->rtfxRefCount);
- if(node->rtfxRefCount <= 0)
+ if(LOOSE_NODE(node))
{
- ASSERT(node->nodeType == DOM_DOCUMENT_NODE || node->ownerDocument);
- DOM_Document_destroyNode(node->nodeType == DOM_DOCUMENT_NODE ?
- node : node->ownerDocument, node);
+ ASSERT(node->parentNode == NULL);
+ if(node->rtfxRefCount <= 0)
+ {
+ ASSERT(node->nodeType == DOM_DOCUMENT_NODE || node->ownerDocument);
+ DOM_Document_destroyNode(node->nodeType == DOM_DOCUMENT_NODE ?
+ node : node->ownerDocument, node);
+ }
}
}
};
@@ -1380,7 +1383,7 @@ namespace DOM
return *this;
}
- ~NodeList()
+ virtual ~NodeList()
{ DEC_NODELIST_REF(*this); }
bool operator==(const NodeList& other) const
@@ -1473,13 +1476,15 @@ namespace DOM
NamedNodeMap(const NamedNodeMap& list) :
NodeList(list) { }
+ virtual ~NamedNodeMap() {}
+
NamedNodeMap& operator=(const NamedNodeMap& other)
{ NodeList::operator=(other); return *this; }
NamedNodeMap& operator=(void* null)
{ NodeList::operator=(null); return *this; }
- const NamedNodeMap* operator->() const
+ const NamedNodeMap* operator->() const
{ return (const NamedNodeMap*)this; }
- NamedNodeMap* operator->()
+ NamedNodeMap* operator->()
{ return this; }
virtual int getLength() const
@@ -1516,7 +1521,7 @@ namespace DOM
return node;
}
- virtual Node removeNamedItem(const dom_str& name)
+ Node removeNamedItem(const dom_str& name)
throw(DOMException)
{
ASSERT_VALID();
@@ -1536,7 +1541,7 @@ namespace DOM
}
#endif
- virtual Node setNamedItem(const Node& arg)
+ Node setNamedItem(const Node& arg)
throw(DOMException)
{
ASSERT_VALID();