* Patch from Bart Broersma to fix deleting non-empty key (bug ID 0035132)

git-svn-id: trunk@41816 -
This commit is contained in:
michael 2019-04-01 17:06:56 +00:00
parent d13f0c3f80
commit 6c7da3cca4

View File

@ -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;