[Libreoffice] [REVIEW] Fix for fdo#37226

Kohei Yoshida kyoshida at novell.com
Tue May 17 09:04:16 PDT 2011


Hi there,

The attached patch fixes the crasher reported in the following bug:

https://bugs.freedesktop.org/show_bug.cgi?id=37226

and also several other usage of standard algorithms which I believe is
incorrect, since the existing code passes the result of an evaluation
which is always boolean (unless boost::bind overloads those operators to
return something else, which I doubt it does).  There were several cases
where such evaluation result was passed to standard algorithms, one of
which caused the crash.

The existing code which I replaced used boost::bind.  In my first
attempt, I tried to keep that use of boost::bind since that seems like a
pretty elegant way to create function objects in-situ.  But I didn't
find a way to achieve that after some google search, so I resorted to
just plain simple function objects to get the job done.

It's worth noting that the existing code is a result of one of the
DECLARE_LIST removal tasks.  And I noticed that it actually changed the
behavior of the code prior to the DECLARE_LIST removal.  So, some of the
change I made in my patch is based on the code prior to the removal, to
bring the original behavior back.

This code is used pretty much only by the STYLE cell function, which, I
admit, I didn't know existed. ;-)  I tested its run-time behavior after
I made my change, and confirm that it works as advertised, with no
crash, I might add.

I tried to write unit test for this, but because of the way the STYLE
function works which involves timer handler, it was rather difficult to
write unit test for it.  Hopefully my run-time test is sufficient to get
the patch included.

I appreciate your review and/or rubber-stamping. ;-)

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>


More information about the LibreOffice mailing list