🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #29

Handling Exceptions on form Creation

#29
From: Peter Ege
Date: Fri, 05 Nov 2004 17:53
41 lines
2197 bytes
I have a MDI application and sometimes I'm running into problems
(AV's, OutofResource errors, etc) when trying to create new child
forms.  Currently, the way it is being handled is as follows:

    try
        frmSomeForm := TfrmSomeForm.Create(Application);
    except
        CleanupClientEnvironment;
        nNdx:= 1;
        while nNdx <= 5 do
        begin
              try
                  frmSomeForm:=TfrmSomeForm.Create(Application);
                  nNdx:= 10;
              except
                  CleanupClientEnvironment;
                  inc(nNdx);
              end;
        end;
        if frmSomeForm = nil then
        begin
             CleanupClientEnvironment;
             frmSomeForm := TfrmSomeForm.Create(Application);
        end;
   end;

As you can see it is attempting to recreate the form a number of
times,  freeing up resources each time, before finally giving up.

Now from what I can gather from this previous thread:
http://groups.google.com/groups?hl=en&lr=&threadm=3fe6f715%40newsgroups.borland.com&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26selm%3D3fe6f715%2540newsgroups.borland.com
  (I'd use tinyurl, but it appears to be broken)

The try�except here shouldn't even be happening if there's a exception
in the form creation.  Is that correct?  Is there a better way to
handle this problem?

Any input is greatly appreciated.

Thank
PE
Technical Details
Message-ID: <197b6a8f.0411050953.454b965a@posting.google.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 109d30,a6ec51a1f294df0c,start
X-Google-Attributes: gid109d30,public
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews1.google.com!not-for-mail
From: pjeGoogleGroups@hotmail.com (Peter Ege)
Newsgroups: borland.public.delphi.language.objectpascal
Subject: Handling Exceptions on form Creation
Date: 5 Nov 2004 09:53:31 -0800
Organization: http://groups.google.com
Lines: 41
Message-ID: <197b6a8f.0411050953.454b965a@posting.google.com>
NNTP-Posting-Host: 144.189.40.223
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1099677212 32252 127.0.0.1 (5 Nov 2004 17:53:32 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 5 Nov 2004 17:53:32 +0000 (UTC)