mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:29:25 +02:00
* Patch from Bart Broersma to fix deleting non-empty key (bug ID 0035132)
git-svn-id: trunk@41816 -
This commit is contained in:
parent
d13f0c3f80
commit
6c7da3cca4
@ -234,13 +234,23 @@ end;
|
||||
Function TXmlRegistry.DeleteKey(KeyPath : UnicodeString) : Boolean;
|
||||
|
||||
Var
|
||||
N : TDomElement;
|
||||
N, Curr : TDomElement;
|
||||
Node: TDOMNode;
|
||||
|
||||
begin
|
||||
N:=FindKey(KeyPath);
|
||||
Result:=(N<>Nil);
|
||||
If Result then
|
||||
begin
|
||||
//if a key has subkeys, result shall be false and nothing shall be deleted
|
||||
Curr:=N;
|
||||
Node:=Curr.FirstChild;
|
||||
While Assigned(Node) do
|
||||
begin
|
||||
If (Node.NodeType=ELEMENT_NODE) and (Node.NodeName=SKey) then
|
||||
Exit(False);
|
||||
Node:=Node.NextSibling;
|
||||
end;
|
||||
(N.ParentNode as TDomElement).RemoveChild(N);
|
||||
FDirty:=True;
|
||||
MaybeFlush;
|
||||
|
Loading…
Reference in New Issue
Block a user