[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
Albert Astals Cid
aacid at kde.org
Wed Jan 23 14:51:12 PST 2008
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?
Albert
>
> > } else {
> > add (copyString(key), val);
> > }
More information about the poppler
mailing list