[poppler] 11 commits - poppler/Annot.cc poppler/Annot.h poppler/Decrypt.cc poppler/Decrypt.h poppler/Dict.cc poppler/Dict.h poppler/Form.cc poppler/PDFDoc.cc poppler/PDFDoc.h poppler/Stream.cc poppler/Stream.h poppler/XRef.cc poppler/XRef.h test/Makefile.am test/pdf-fullrewrite.cc

Carlos Garcia Campos carlosgc at gnome.org
Thu Jan 24 01:24:09 PST 2008


El mié, 23-01-2008 a las 23:51 +0100, Albert Astals Cid escribió:
> A Dimecres 23 Gener 2008, Carlos Garcia Campos va escriure:
> > El sáb, 19-01-2008 a las 04:39 -0800, Albert Astals Cid escribió:
> > > commit e20f6a8e9ac3936b4bc03710a71fe390dfc4c094
> > > Author: Julien Rebetez <julien at fhtagn.net>
> > > Date:   Sat Jan 19 12:52:02 2008 +0100
> > >
> > >     Add deep copy constructor to Dict.
> > >
> > > diff --git a/poppler/Dict.cc b/poppler/Dict.cc
> > > index 0c74566..be82890 100644
> > > --- a/poppler/Dict.cc
> > > +++ b/poppler/Dict.cc
> > > @@ -89,7 +101,7 @@ void Dict::set(char *key, Object *val) {
> > >    e = find (key);
> > >    if (e) {
> > >      e->val.free();
> > > -    e->val = *val;
> > > +    val->copy(&e->val);
> >
> > I think this change is wrong. Dict::set should behave in the same way
> > whether the key already exists or not. With this change, if the key
> > already exists, the object will be copied (including dynamically
> > allocated memory) which means that the original object should be freed
> > after ->set. However, if the key doesn't exist Dict:add is called and
> > the object variable is copied (but not the dynamically allocated memory)
> > which means that the original object shouldn't be freed since it will be
> > freed by the Dict. Here is an example:
> >
> > Object obj1;
> > obj1.initName ("bar");
> > dict->set ("foo", &obj1);
> > obj1.free (); -> should we call obj1.free () here? it depends . . .
> >
> > This it definitely not consistent.
> 
> Yeah, it seems we overlooked that, should be remove it until Julien says why 
> he changed it?

well, it doesn't hurt too much, it's leaking memory, but it doesn't
crash. 

> Albert
> 
> >
> > >    } else {
> > >      add (copyString(key), val);
> > >    }
> 
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler

-- 
Carlos Garcia Campos
   elkalmail at yahoo.es
   carlosgc at gnome.org
   http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente
Url : http://lists.freedesktop.org/archives/poppler/attachments/20080124/7bc225bd/attachment.pgp 


More information about the poppler mailing list