fix issue 184. clean up xcode project.
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 2893a27..9928444 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -1623,24 +1623,7 @@
 

 XMLDocument::~XMLDocument()

 {

-    DeleteChildren();

-    delete [] _charBuffer;

-

-#if 0

-    _textPool.Trace( "text" );

-    _elementPool.Trace( "element" );

-    _commentPool.Trace( "comment" );

-    _attributePool.Trace( "attribute" );

-#endif

-

-#ifdef DEBUG

-	if ( Error() == false ) {

-		TIXMLASSERT( _elementPool.CurrentAllocs()   == _elementPool.Untracked() );

-		TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );

-		TIXMLASSERT( _textPool.CurrentAllocs()      == _textPool.Untracked() );

-		TIXMLASSERT( _commentPool.CurrentAllocs()   == _commentPool.Untracked() );

-	}

-#endif

+    Clear();

 }

 

 

@@ -1654,6 +1637,22 @@
 

     delete [] _charBuffer;

     _charBuffer = 0;

+

+#if 0

+    _textPool.Trace( "text" );

+    _elementPool.Trace( "element" );

+    _commentPool.Trace( "comment" );

+    _attributePool.Trace( "attribute" );

+#endif

+    

+#ifdef DEBUG

+    if ( Error() == false ) {

+        TIXMLASSERT( _elementPool.CurrentAllocs()   == _elementPool.Untracked() );

+        TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );

+        TIXMLASSERT( _textPool.CurrentAllocs()      == _textPool.Untracked() );

+        TIXMLASSERT( _commentPool.CurrentAllocs()   == _commentPool.Untracked() );

+    }

+#endif

 }

 

 

@@ -1821,6 +1820,16 @@
 

     ptrdiff_t delta = p - start;	// skip initial whitespace, BOM, etc.

     ParseDeep( _charBuffer+delta, 0 );

+    if (_errorID) {

+        // clean up now essentially dangling memory.

+        // and the parse fail can put objects in the

+        // pools that are dead and inaccessible.

+        DeleteChildren();

+        _elementPool.Clear();

+        _attributePool.Clear();

+        _textPool.Clear();

+        _commentPool.Clear();

+    }

     return _errorID;

 }