https://bugs.documentfoundation.org/show_bug.cgi?id=101563
--- Comment #50 from Aron Budea <ba...@caesar.elte.hu> ---
(In reply to Noel Grandin from comment #47)
> void GraphicObject::SetGraphic( const Graphic& rGraphic, const OUString&
> rLink )
> {
> // avoid self-assignment, because SetGraphic clears maLink
> if ( rGraphic != this.maGraphic || rLink != this.maLink)
> {
> SetGraphic( rGraphic );
> maLink = rLink;
> }
> }
You're right that this seems to be the best place to deal with this potential
issue. I wouldn't combine the two conditions, though, if somehow the first is
true (so rGraphic != this.maGraphic), but the second is false (so rLink ==
this.maLink, or rather &rLink == &this.maLink), the bug is still triggered.
This might never happen with the current surrounding code, but can it be ruled
out completely?
How about this:
void GraphicObject::SetGraphic( const Graphic& rGraphic, const OUString& rLink
)
{
// avoid self-assignment, because SetGraphic clears maLink
if (rGraphic == this.maGraphic)
{
maLink = rLink;
}
else if (&rLink != &this.maLink)
{
SetGraphic( rGraphic );
maLink = rLink;
}
else
{
OUString rLinkCopy;
rLinkCopy = rLink;
SetGraphic( rGraphic );
maLink = rLinkCopy;
}
}
(I haven't tested the code)
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs