Browse Source

dom.pp: Ignore node read-only property when its owning document is being destroyed (enables destroying nodes in arbitrary order).

git-svn-id: trunk@13175 -
sergei 16 years ago
parent
commit
0a242ba49f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      packages/fcl-xml/src/dom.pp

+ 4 - 2
packages/fcl-xml/src/dom.pp

@@ -180,7 +180,8 @@ type
     nfRecycled,
     nfLevel2,
     nfIgnorableWS,
-    nfSpecified
+    nfSpecified,
+    nfDestroying
   );
   TNodeFlags = set of TNodeFlagEnum;
 
@@ -1002,7 +1003,7 @@ end;
 
 procedure TDOMNode.Changing;
 begin
-  if nfReadOnly in FFlags then
+  if (nfReadOnly in FFlags) and not (nfDestroying in FOwnerDocument.FFlags) then
     raise EDOMError.Create(NO_MODIFICATION_ALLOWED_ERR, 'Node.CheckReadOnly');
 end;
 
@@ -1755,6 +1756,7 @@ end;
 
 destructor TDOMDocument.Destroy;
 begin
+  Include(FFlags, nfDestroying);
   FreeAndNil(FIDList);   // set to nil before starting destroying children
   FEmptyNode.Free;
   inherited Destroy;