这段时间一直受到程序自动关闭的困扰。程序运行过程中,经常会出退什么提示信息也没有,就自动关闭了。请教各位大虾,在什么情况下会引起程序的异常关闭呢?我程序中,基本上都是有异常处理代码的。但是还是一直这样。

解决方案 »

  1.   

    先谢谢楼上,因为程序是服务端,我创建了一个内存映像文件,然后在另一个程序中监控程序中断的位置,但是中断的位置,但是这个中断的位置,我感觉不出会引起程序关闭,而且我都是做了try..except处理的。可否再指点一下?
      

  2.   

    贴出代码:
    try
                      if (BaseObject.m_btRaceServer <> RC_PLAYOBJECT) then begin
                        shared.GlobalVal[497] := 1079;
                        nCheckCode := 38;
                        str := BaseObject.GetShowName;
                        shared.GlobalVal[497] := 1080;
                        str := str +'|'+inttostr(BaseObject.m_Abil.Level);
                        shared.GlobalVal[497] := 1081;
                        nCheckCode := 39;
                        shared.GlobalVal[497] := 1082;
                        SendMsg(BaseObject, RM_TURN, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, str);
                      end else begin
                        shared.GlobalVal[497] := 1083;
                        nCheckCode := 40;
                        str := BaseObject.GetShowName;
                        nCheckCode := 41;
                        shared.GlobalVal[497] := 1084;
                        if (m_btPermission > 3) and (TPlayObject(BaseObject).m_boDouli or m_pEnvir.boHidePlayName) then begin
                          shared.GlobalVal[497] := 1085;
                          SendMsg(BaseObject, RM_TURN, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, BaseObject.m_sCharName)
                        end else begin
                          shared.GlobalVal[497] := 1086;
                          SendMsg(BaseObject, RM_TURN, BaseObject.m_btDirection, BaseObject.m_nCurrX, BaseObject.m_nCurrY, 0, str);
                        end;
                      end;
                      shared.GlobalVal[497] := 1087;
                    Except
                      shared.GlobalVal[497] := 1088;
                    end;
      

  3.   

    中断在
    shared.GlobalVal[497] := 1079;的下一行BaseObject是一个类,请问一下,如果这个类为被Free了,但是没有置为NIL,会引起程序自动关闭这样的后果吗?
      

  4.   

    try
      if (BaseObject<>nil) and (BaseObject.m_btRaceServer <> RC_PLAYOBJECT) then beginBaseObject在释放里用FreeandNil(BaseObject).