[Bug 8667] New: Number of subitems in treeview keeps increasing
Wine Bugs
wine-bugs at winehq.org
Mon Jun 11 05:45:59 CDT 2007
http://bugs.winehq.org/show_bug.cgi?id=8667
Summary: Number of subitems in treeview keeps increasing
Product: Wine
Version: 0.9.37.
Platform: PC
URL: http://www.bloodshed.net/dev/devcpp.html
OS/Version: Linux
Status: NEW
Keywords: download, source, conformance
Severity: normal
Priority: P2
Component: wine-comctl32
AssignedTo: wine-bugs at winehq.org
ReportedBy: damjan.jov at gmail.com
Odd bug in Dev-C++ version 4.9.9.2 (Delphi app, open-source).
Open or create a project with 1 or more files.
Now collapse the project treeview in the "Project" tab, right-click the project
and go to "Project Options", click "Ok" to close the dialog that comes up, and
the files in the project appear one additional time in the treeview. So the
first time you do this you could have
Project
|-A
|-B
The second time you do this you'd have:
Project
|-A
|-B
|-A
|-B
The effects are cumulative, the third time:
Project
|-A
|-B
|-A
|-B
|-A
|-B
If you open the "Project Options" with the treeview expanded instead of
collapsed, the items appear normally.
While I'm not a Delphi expert I do believe the bug is caused by this snippet of
code in project.pas (since the other places where the code is called from can
also be made to manifest the bug):
procedure TProject.RebuildNodes;
var
idx: integer;
oldPaths: TStrings;
tempnode: TTreeNode;
begin
MainForm.ProjectView.Items.BeginUpdate;
//remember if folder nodes were expanded or collapsed
//create a list of expanded folder nodes
oldPaths := TStringList.Create;
with MainForm.ProjectView do
for idx := 0 to Items.Count -1 do
begin
tempnode := Items[idx];
if tempnode.Expanded AND (tempnode.Data=Pointer(-1)) then
//data=pointer(-1) - it's folder
oldPaths.Add(GetFolderPath(tempnode));
end;
fNode.DeleteChildren;
CreateFolderNodes;
{
for idx:=0 to pred(fFolders.Count) do
MakeNewFileNode(fFolders[idx], True).Data:=Pointer(-1);}
for idx:= 0 to pred(fUnits.Count) do
begin
fUnits[idx].Node:= MakeNewFileNode(ExtractFileName(fUnits[idx].FileName),
False, FolderNodeFromName(fUnits[idx].Folder));
fUnits[idx].Node.Data:= pointer(idx);
end;
for idx:=0 to pred(fFolders.Count) do
TTreeNode(fFolderNodes[idx]).AlphaSort(False);
Node.AlphaSort(False);
//expand nodes expanded before recreating the project tree
fNode.Collapse(True);
with MainForm.ProjectView do
for idx := 0 to Items.Count -1 do
begin
tempnode := Items[idx];
if (tempnode.Data=Pointer(-1)) then //it's a folder
if oldPaths.IndexOf(GetFolderPath(tempnode)) >= 0 then
tempnode.Expand(False);
end;
FreeAndNil(oldPaths);
fNode.Expand(False);
MainForm.ProjectView.Items.EndUpdate;
end;
A +treeview trace (attached next) is not very revealing to me. The interesting
part is between GetCount returning 2 and 3.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the wine-bugs
mailing list