🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.objectpascal
1 messages
1 total messages Started by Peter Ege Fri, 05 Nov 2004 17:53
Handling Exceptions on form Creation
#29
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads