[PUSHED 3-5][REVIEW-3-5-5] Use after delete in oox
Eike Rathke
erack at redhat.com
Tue Jun 19 13:32:38 PDT 2012
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 Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3 9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120619/6bf5c0fb/attachment.pgp>
More information about the LibreOffice
mailing list