Koen Deforche wrote:
Hey Andrii,

2009/8/30 Andrii Arsirii <[email protected]>:
  
Hi.
In my Wt application we have class Application that is derived from
Wt::WApplication.
And we perform  some cleanup in ~Application() destructor.

I've noticed that destructor is never called in FCGI mode when I do
"apachectl restart" (although the sessions really exist).
On the other hand it's called when I deploy application in wthttp mode and
stop it using CTRL+C.

I found 2 faulty places:
1) Wt::~WApplication() destructor has to be declared virtual if we want the
derived destructor to be called when we make deletion on a pointer to a base
class.
For some reason derived destructor is called on my setup even without
virtual declaration, but anyway C++ standard says the way I said.
And this could lead to problems with other OS/compilers if you don't declare
virtual Wt::~WApplication().
    

I do not believe this is an actual problem since WApplication inherits
from WObject, which declares a virtual destructor.
This automatically makes the destructor of any derived class virtual.
  

Indeed this can be the way you say, although I always thought that if I do "delete ptr" where ptr is a pointer to base class,
while object is of a derived class, the only way the destructor of object will be called is when base class has its destructor being virtual.

  
2) Apache restarts process with SIGHUP. And it's not handled by Wt in FCGI
connector. Therefore we have 1) memory leak, 2) no destructor called - each
time we make restart.
    

Thanks, I didn't know that. I have applied your patch to my local tree.

Regards,
koen

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest


  


-- 
Andrii Arsirii
Streamco
http://streamco.org.ua
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to