Delphi 2009 ShellTreeView/ShellListView修复

3

当使用ShellTreeView/ShellListView在Delphi 2009工程的主窗体上,在IDE中关闭该工程时,会生成“Index out of bounds(0)”异常。是否有ShellTreeView/ShellListView的修复程序以消除这些异常?

4个回答

3

这是我第一次听到这件事。如果需要安慰,我可以在这里重现它。

你应该做的第一件事可能是在Quality Central上提交错误报告,并在Codegear NNTP新闻组上提问。

此外,请尝试将TCustomShellListView.GetFolder更改为下面的代码,并查看效果如何。您需要重新编译软件包 - 请注意,由于某种原因,D2009会在Windows\System32中安装第二个软件包副本。我已将其更名,目前没有任何不良影响。

function TCustomShellListView.GetFolder(Index: Integer): TShellFolder;
begin
  if Index < FFolders.Count then
    Result := TShellFolder(FFolders[Index])
  else
    Result := NIL;
end;

我非常同意 - 这应该发布在QC中,然后其他人可以在那里投票支持它。 - Argalatyr

0

问题仅在设计时发生。

这里有一个解决方案,适用于ShellCtrls.pas文件中的TShellListView组件:

destructor TCustomShellListView.Destroy;
begin
  ClearItems;
  if not (csDesigning in ComponentState) then // Avoid design time error
  FFolders.Free;
  FreeAndNil(FRootFolder);
  inherited;
end;

procedure TCustomShellListView.DestroyWnd;
begin
  ClearItems;

  // Avoid error in inherited DestroyWnd procedure :
  if csDesigning in ComponentState then
  Items.Count := 0;
  inherited DestroyWnd;
end;

0

到目前为止,所提出的解决方案都无法修复这个问题... 但是,如果我从演示项目中移除ShellListView组件,然后关闭项目,就不会产生异常。我认为问题出在ShellListView组件上,而不是ShellTreeView。

这个问题可能比看起来的要严重。


0
{ TCustomShellTreeView }
...
  TCustomShellTreeView = class(TCustomTreeView, IShellCommandVerb)
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override; //$$jp shellctrl.pas 26.08.2007: missing "override"
    procedure Refresh(Node: TTreeNode);
...

destructor TCustomShellTreeView.Destroy;
begin
  //$$jp: ClearItems;
  //$$jp: raises EInvalidOperation and access-violations (shellctrl.pas 26.08.2007)
  FRootFolder.Free;
  inherited;
end;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接