sorry, I'have sent a wrong fix I'll have a look at the codestyle file - thanks =D
2015-03-17 21:24 GMT-03:00 Lubomir I. Ivanov <[email protected]>: > On 18 March 2015 at 02:22, Marcos Cardinot <[email protected]> wrote: > > 2015-03-17 21:16 GMT-03:00 Lubomir I. Ivanov <[email protected]>: > > > >> On 18 March 2015 at 01:45, Marcos Cardinot <[email protected]> wrote: > >> > > >> > Hello folks, > >> > > >> > The current code in RulerItem2::settingsChanged() is dereferencing the > >> > null pointer 'profWidget'. > >> > It can cause a segmentation fault. > >> > > >> > > >> > >> hi, there is no need for the braces { } around the single lined "if" > >> condition. > >> could you remove them and resend? > > > > > > Hi, of course. > > Is there a kind of code style doc somewhere? > > > > the source code is the coding style, mostly. > but, yes there is a CodingStyle file in the root folder...also the > "Linux kernel coding style" is a sane reference! > > in fact, i just sent a small related change to CodingStyle. > > lubomir > -- >
From d75baa04c1563543c97e9c327073bae2dd55480d Mon Sep 17 00:00:00 2001 From: Marcos CARDINOT <[email protected]> Date: Tue, 17 Mar 2015 20:35:11 -0300 Subject: [PATCH] RulerItem2::settingsChanged() - NULL pointer dereference The current code is dereferencing the null pointer 'profWidget'. It can cause a segmentation fault. Signed-off-by: Marcos Cardinot <[email protected]> --- qt-ui/profile/ruleritem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp index ddd8f46..d5742ef 100644 --- a/qt-ui/profile/ruleritem.cpp +++ b/qt-ui/profile/ruleritem.cpp @@ -83,7 +83,11 @@ void RulerItem2::settingsChanged() ProfileWidget2 *profWidget = NULL; if (scene() && scene()->views().count()) profWidget = qobject_cast<ProfileWidget2 *>(scene()->views().first()); - setVisible(profWidget->currentState == ProfileWidget2::PROFILE ? prefs.rulergraph : false); + + if (profWidget && profWidget->currentState == ProfileWidget2::PROFILE) + setVisible(prefs.rulergraph); + else + setVisible(false); } void RulerItem2::recalculate() -- 1.7.9.5
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
