dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pnet-developers] Destructors are not being called - bug or usage er


From: David Logan
Subject: Re: [Pnet-developers] Destructors are not being called - bug or usage error?
Date: Sat, 15 May 2004 07:27:15 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040316

OK, technically I can respect that. But in oop-speak, I thought the idea was that code and data were self contained. That statement would mean that a class is responsible for its *own* cleanup. But now, by not requiring destructor calls, the requirement that a class execut its "shutdown code" or "cleanup code" has now been moved to the calling class, hasn't it?

David Logan

Rhys Weatherley wrote:
On Friday 14 May 2004 11:56 pm, David Logan wrote:

  
At program termination, neither Form1.Dispose(bool)  nor ~GlobalSettings
is getting called. I was counting on it to make sure that GlobalSettings
was written to a file. I suppose I will try instead to move the settings
save to a Closing() event in Form1.
    

The Form.Closed event is where cleanup operations like this will normally be 
placed.  You can also trap Application.ApplicationExit, or put the code just 
after your main call to "Application.Run".

While the engine should make the best effort to call all finalizers prior to 
exit, the standard makes no guarantee.  If you need something to happen on 
exit, then you must arrange for it to be called explicitly.

Cheers,

Rhys.

_______________________________________________
Pnet-developers mailing list
address@hidden
http://dotgnu.org/mailman/listinfo/pnet-developers

  


reply via email to

[Prev in Thread] Current Thread [Next in Thread]