Re: Why does this program segfault?
On Wed, Jan 16, 2002 at 09:52:18PM +0100, Ulrich Eckhardt wrote:
> What does that have to do with Josip Rodin's comment about the sponsoring of
> non-free packages ? (Hint: fix your mail-client)
I've already whined about this. :)
> > Is it because pkgDepCache has a virtual destructor? If so am I supposed
> > to subclass it or am I just using it the wrong way? (Sorry, the the
> > intricacies of C++ are a bit hazy for me and libapt-pkg is practically
> > undocumented.)
> >
> Hmmm, what about a backtrace ?
It's in the destructor of one of the package objects; I believe a
pointer is being freed twice.
> > pkgDepCache cache = *cachefile;
> I am not sure if this is intended to be used that way, that is if the
> copy-operation is really fully implemented (usually, you would rather not
> copy the Object but ust pass references or pointers). Try to make this line
The implicit copy ctor shouldn't be getting defined (there's a non-default
ctor), so I'm not sure exactly how that's being constructed.
> > for (pkgCache::PkgIterator it = cache.PkgBegin(); !it.end(); it++)
> this loop is a bit different from typical C++, there you would probably have
> something like
> for (pkgCache::PkgIterator it = cache.PkgBegin(); it!=cache.PkgEnd(); ++it)
> but that is not necessarily wrong.
Comments in one of the headers say that it doesn't use the regular C++
iterator semantics.
--
Glenn Maynard
Reply to: