程序点击推出按钮时 ,弹出确认的 MessageDlg,但有时就会发生异常, 弹出个异常地址不出现确认的信息框。
查看异常信息, 发现是在 Classes.pas 里的Notification函数里。
procedure TComponent.Notification(AComponent: TComponent;
  Operation: TOperation);
var
  I: Integer;
begin
  if (Operation = opRemove) and (AComponent <> nil) then
    RemoveFreeNotification(AComponent);
  if FComponents <> nil then
  begin
    I := FComponents.Count - 1;
    while I >= 0 do
    begin
      TComponent(FComponents[I]).Notification(AComponent, Operation);       //这一行。
      Dec(I);
      if I >= FComponents.Count then
        I := FComponents.Count - 1;
    end;
  end;
end;
不知大家有什么建议??

解决方案 »

  1.   

    代码不全,需要看你调用MessageDlg函数的代码段才能分析
      

  2.   

    procedure TfrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin  if not FExited  then begin
        if MessageDlg( '您将退出当前程序,您是否确认退出?(Y/N)', mtConfirmation,
                     [mbYes,mbNo], 0,mbYes) = mrYES  then  begin
          FExited := TRUE;
      end;
      end;
      CanClose := FExited;
    end;
      

  3.   


    是在 closequery里做的, 这会儿还没正式开始释放东西呢!!
      

  4.   

    偶尔会出现,通过MAP文件 追查错误地址,就是首贴 那个位置了、TComponent(FComponents[I]).Notification(AComponent, Operation);       //这一行不知道会不会和 VCL的 Notification有关系。。
      

  5.   

    RemoveFreeNotification(AComponent);这个算不算放掉了这个方法后AComponent的东西还存在么
      

  6.   

    这个是  delphi 里面的代码, classes.pas 里面的
    我只是显示 MEssageDlg 发现地址错误,查到是执行到这行代码附近报错的。