Hi,
On Mittwoch, 2. Mai 2018 12:40:32 CEST Martin Měřinský wrote:
> Build.
> Run (do not open any divelog).
> Log > Add dive
> Segmentation fault (core dumped)
>
> (gdb) bt
> #0 0x000055f187bdd0a0 in ProfileWidget2::setProfileState() (this=this@
> entry=0x55f189e2a4f0)
> at /data/ss/subsurface/profile-widget/profilewidget2.cpp:1204
as a quick-fix, please consider the attached patch. But there are other
occurrences of current_dc, which will have to be scrutinized.
Berthold
>From bbbc8ed381f56ae6fd4fee3563633eef44383ecb Mon Sep 17 00:00:00 2001
From: Berthold Stoeger <[email protected]>
Date: Wed, 2 May 2018 13:21:00 +0200
Subject: [PATCH] Profile: Fix null-pointer access.
If there is no dive, the macro current_dc returns NULL.
Signed-off-by: Berthold Stoeger <[email protected]>
---
profile-widget/profilewidget2.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index da3eaad90..1052b5b71 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1201,7 +1201,8 @@ void ProfileWidget2::setProfileState()
ccrsensor1GasItem->setVisible(sensorflag);
ccrsensor2GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 2));
- ocpo2GasItem->setVisible((current_dc->divemode == PSCR) && prefs.show_scr_ocpo2);
+ struct divecomputer *dc = current_dc;
+ ocpo2GasItem->setVisible((dc && dc->divemode == PSCR) && prefs.show_scr_ocpo2);
heartBeatItem->setVisible(prefs.hrgraph);
diveCeiling->setVisible(prefs.calcceiling);
--
2.14.1
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface