Actually I have hit a simliar problem where if I close the program 
myself, it will close, but if windows tells it to close, it will only go 
as far as onCloseQuery, where I have set it to be CanClose:=true; but it 
will not close it!

Anyone know what casues this?

Jeremy

-----Original Message-----
From: <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Tue, 11 Nov 2003 09:20:45 +1300
Subject: RE: [DUG]:  Close failure

> Is the following possible reasoning?
> 
> You've added DirMonitor1 to DirMonList.
> 
> You free DirMonitor1.
> 
> When you call DirMonList.Clear, internally maybe it tries to reference
> and free DirMonitor.  Have a look at the source maybe.
> 
> One solution might be to cycle through your DirMonList and free all
> items yourself.  After that, you shouldn't have to call Clear, but can
> should free your DirMonList straight away.
> 
> Alternatively, can you use TObjectList and see if it frees contained
> objects for you?
> 
> Not sure how accurate these are, but maybe some food for thought.
> 
> Cheers,
> 
> C.
> 
> -----Original Message-----
> From: Alistair George [mailto:[EMAIL PROTECTED]
> 
> Good morning.
> Got a problem been bugging my program for ages. It raises its ugly head
> sometimes when in the FormCloseQuery event, and is one specific item.
> Here goes (shortened for brevity)............
> 
> DirMonitor1: TDirMonitor;
> DirMonList: Tcomponentlist;
> 
> procedure TMainform.DirMonArrayAdd(WatchDir: string);
> var Tval: Integer;
>   CurrDir, PathVal, NameVal: string;
>   DriveVal: Char;
> begin
>   DirMonitor1 :=3D TdirMonitor.create(self);
>   DirMonList.Add(DirMonitor1);
>   TDirMonitor(DirMonList.Items[DirMonList.count - 1]).Directory :=3D
> CurrDir;
>   TDirMonitor(DirMonList.Items[DirMonList.count - 1]).Onchange :=3D
> DirMonitor1Change;
>   TDirMonitor(DirMonList.Items[DirMonList.count -
> 1]).FilterNotification
> :=3D [nfFILE_NAME, nfSIZE, nfLAST_WRITE];
>   TDirMonitor(DirMonList.Items[DirMonList.count - 1]).FilterAction :=3D
> [faADDED, faMODIFIED];
>   TDirMonitor(DirMonList.Items[DirMonList.count - 1]).WatchsubTree :=3D
> RxChecklistBox12.Checked[1];
> end;
> 
> Then in FormCloseQuery I have tried all combinations of below:
> //    DirMonArrayStopStart(False); //this tells it to stop monitoring
> //    DirMonitor1.Free;
> //    DirmonList.Clear;
>     FreeandNil(DirMonitor1);
> //    FreeandNil(DirMonlist);
> 
> DirmonList.Clear; raises an exception every time. With
> FreeandNil(DirMonitor1);
> being the least offensive.
> -----------------------------------------------------------------------
> ----
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to