[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdenetwork/librss
From:       David Faure <dfaure () trolltech ! com>
Date:       2003-06-17 10:13:11
[Download RAW message or body]

On Tuesday 17 June 2003 02:44, Frerich Raabe wrote:
> On Monday 16 June 2003 21:49, Frerich Raabe wrote:
> > On Monday 16 June 2003 21:11, David Faure wrote:
> > > CVS commit by faure:
> > >
> > > Fix reference counting, which fixes Tobias' testcase.
> >
> > Hmm, this looks weird to me...
> 
> I just looked into it some more and I think adding a ref() in the Document 
> constructor is inconsistent with the rest of hte library, and it's also not 
> touching the root of the problem:
> 
> The actual problem is that the "loadingComplete" signal passes the generated 
> Document instance by value, and at the end of the slot connected to 
> loadingComplete, that Document instance will get destructed - which means 
> that the Image and anything else which belongs to it get deleted as well.

OK.

> Tobias' testcase probably gets easily fixed, just by doing something like 
> "m_doc = doc;", read: creating a copy of the parsed Document instance which 
> lives longer than the slot connected to the loadingComplete signal.

Or m_image = doc.image() ? But since image() returns a pointer, this won't work.
I think it's a bit broken to use refcounting but to also declare that the document is
the parent of many things. One should be able to store only the image, by
value (to increase the refcount) and to forget about the document, no?

-- 
David FAURE, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
Qtella users - stability patches at http://blackie.dk/~dfaure/qtella.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic