Hi Harri, thanks for the patch, committed
On Sat, 2010-10-02 at 09:40 +0300, Harri Pitkänen wrote:
Hi!
Here goes my first patch. It silences a "possible null pointer dereference" of
pPage (at the end of diff). Perhaps not for merging yet since my build has not
yet progressed far enough to see that it builds and works and I'd also like to
know what is the preferred way of handling warnings like this.
The issue here is that both pFact and fnCreatePage are checked for nullness
but if either of them is null then pPage would get dereferenced as null. So we
will crash here anyway if that is the case, the question is what is the best
way to handle it? With my patch the null pointer crash will happen at the
earliest possible location, but should I add ASSERT(pFact) and
ASSERT(fnCreatePage) to document that this is intentional?
I have to admit the state ( or recommended usage ) of the various
ASSERTish macros lying around the code is a bit of a mystery to me.
Getting of cppcheck noise in this case is a win imo, I pushed your orig
change
http://cgit.freedesktop.org/libreoffice/writer/commit/?id=8b072fd99db5f6ca0f0b3adf9acfebddd3c47854
then I got paranoid, coded to avoid the core ( leaving it up to the
caller to check the page ) and put in ( hopefully ) the correct and
current ASSERT-like macro
http://cgit.freedesktop.org/libreoffice/writer/commit/?id=a2486209b950544c8db3650521d0c9689744f3b8
thanks again and looking forward to more patches, from you
Noel
Context
- Re: [Libreoffice] [PATCH] cppcheck warning in sw/source/ui/uiview/viewprt.cxx · Noel Power
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.