[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

Julien Rebetez julien at fhtagn.net
Thu Jan 24 07:15:50 PST 2008


And here is the patch.

It also removes a memory leak in writeTrailer.

Julien


Carlos Garcia Campos wrote:
> 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
>>     
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dict_set_patch.diff
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20080124/c4143fa3/attachment.bin 


More information about the poppler mailing list