[PUSHED 3-5][REVIEW-3-5-5] Use after delete in oox

Fridrich Strba fridrich.strba at graduateinstitute.ch
Wed Jun 20 01:03:05 PDT 2012


+1 from me too, one more person neede.

F.

On 19/06/12 22:32, Eike Rathke wrote:
> Hi Lubos,
> 
> On Tuesday, 2012-06-19 15:20:40 +0200, Lubos Lunak wrote:
> 
>>  please review and backport to 3-5 and 3-5-5 the attached patch.
> 
> Looks sensible, pushed to 3-5
> Two more reviews needed for 3-5-5
> 
> Btw, this ...
> 
>> -const ShapeBase* ShapeContainer::takeLastShape()
>> +boost::shared_ptr< ShapeBase > ShapeContainer::takeLastShape()
>>  {
>>      assert( mrDrawing.getType() == VMLDRAWING_WORD );
>>      if( maShapes.empty())
>> -        return NULL;
>> -    const ShapeBase* ret = maShapes.back().get();
>> +        return boost::shared_ptr< ShapeBase >();
>> +    boost::shared_ptr< ShapeBase > ret = maShapes.back();
>>      maShapes.pop_back();
>>      return ret;
>>  }
> 
> ... could be written as
> 
> boost::shared_ptr< ShapeBase > ShapeContainer::takeLastShape()
> {
>     boost::shared_ptr< ShapeBase > ret;
>     assert( mrDrawing.getType() == VMLDRAWING_WORD );
>     if( !maShapes.empty())
>     {
>         ret.reset( maShapes.back());
>         maShapes.pop_back();
>     }
>     return ret;
> }
> 
> to help compilers optimize the return to the caller if the return type
> is defined at the start of the method (or so I have read ...)
> 
>   Eike
> 
> 
> 
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
> 




More information about the LibreOffice mailing list