[Kwintv] Patch to fix memory leak when lirc-support is in

Rizsanyi Zsolt kwintv@mail.kde.org
Tue, 15 Oct 2002 17:19:57 +0200


On Tuesday 15 October 2002 15:50, George Staikos wrote:
> On Tuesday October 15 2002 07:35, Rizsanyi Zsolt wrote:
> > > > Correct me if I'm wrong, but if an QObject has a declared parent,
> > > > then it will be automatically deleted when the parent is deleted.
> > >
> > > Really? OK, I didn't know that.
> > >
> > > I ran qtvision through LeakTracer
> > > (http://www.andreasen.org/LeakTracer/) and it found this to be a memory
> > > leak - but you may be right.
> > >
> > > > So this fix is not needed... (and even could cause a crash because of
> > > > double deletion)
> > >
> > > My added "delete lirc" doesn't make it crash.
> >
> > I'm not a qt guru either. I just read that in the Qt documentation.
> > But if your leaktracer shows that, then maybe somebody with more
> > knowledge could help us out.
>
>   Furthermore, if it is only created once and deleted on exit, then it
> doesn't matter because it can't leak more than once which is ok.
>
>   After seeing this patch, I'm wondering if mainwindow is the right place
> to put the lirc code though.  This code should really work in other clients
> too (the panel applet, extension, etc).  Is there a better place for it?

No it could not go to other place, because it works by calling actions, and 
the actions are only defined/available in MainWindow (whose 
actionCollection() is initialized by clients/qtvisionactions.h|cpp).
Of course that could be changed (and maybe even should be :), but I will let 
that to you :) (I have not yet considered using nor developing the applet or 
extension - to be honest I do not understand what would I gain with them over 
the application)

Regards
Zsolt