From: Andreas H. <ah...@us...> - 2006-01-24 09:25:58
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27571/run Modified Files: JvDBTreeView.pas Log Message: Fixed Mantis #3376: TJvDBTreeView AV after deleteng of node Index: JvDBTreeView.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvDBTreeView.pas,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** JvDBTreeView.pas 24 Jan 2006 09:17:36 -0000 1.43 --- JvDBTreeView.pas 24 Jan 2006 09:25:50 -0000 1.44 *************** *** 1196,1205 **** NewSel := FindNextNode(Selected); ! If (NewSel = nil) then NewSel := Items.GetFirstNode; FDataLink.DataSet.Delete; Selected.Free; ! if (NewSel <> nil) then begin NewSel.Selected := True; --- 1196,1209 ---- NewSel := FindNextNode(Selected); ! if NewSel = nil then ! begin NewSel := Items.GetFirstNode; + if NewSel = Selected then + NewSel := nil; + end; FDataLink.DataSet.Delete; Selected.Free; ! if NewSel <> nil then begin NewSel.Selected := True; *************** *** 1214,1231 **** function TJvCustomDBTreeView.FindNextNode(const Node: TTreeNode): TTreeNode; begin ! if (Node <> nil) and (Node.Parent <> nil) then ! if Node.Parent.Count > 1 then ! if Node.Index = Node.Parent.Count - 1 then ! Result := Node.Parent[Node.Index - 1] else ! Result := Node.Parent[Node.Index + 1] else ! Result := Node.Parent else - { if Items.Count > 1 then - if Node.Index = Items.Count-1 then - Result := Items[Node.Index-1] else - Result := Items[Node.Index+1] - else} Result := nil; end; --- 1218,1241 ---- function TJvCustomDBTreeView.FindNextNode(const Node: TTreeNode): TTreeNode; begin ! if Node <> nil then ! begin ! if Node.Parent <> nil then ! if Node.Parent.Count > 1 then ! if Node.Index = Node.Parent.Count - 1 then ! Result := Node.Parent[Node.Index - 1] ! else ! Result := Node.Parent[Node.Index + 1] else ! Result := Node.Parent else ! if Items.Count > 1 then ! if Node.Index = Items.Count - 1 then ! Result := Items[Node.Index - 1] ! else ! Result := Items[Node.Index + 1] ! else ! Result := nil; ! end else Result := nil; end; |