Crash when opening planner in empty log

Berthold Stoeger bstoeger at mail.tuwien.ac.at
Sat Oct 29 13:30:26 PDT 2022


Hi Robert,

On Samstag, 29. Oktober 2022 21:53:35 CEST Robert Helling wrote:
> > On 29. Oct 2022, at 09:05, Robert Helling via subsurface
> > <subsurface at subsurface-divelog.org> wrote:
> > 
> > Signed PGP part
> > 
> >> On 28. Oct 2022, at 23:35, Berthold Stoeger <bstoeger at mail.tuwien.ac.at
> >> <mailto:bstoeger at mail.tuwien.ac.at>> wrote:> 
> >> I have a suspicion. Could you try if this fixes the problem:
> > Does not fix it, unfortunately. To reproduce: Start Subsurface, press
> > Ctrl-N, Ctrl-L crash.
> > 
> > Best
> > Robert
> 
> I spent some more time with the debugger but to no avail. The following
> behaviour is reproducible:
> 
> The dive is empty (it was just memset to 0). Then in profilewidget.c l. 159,
> 
> 	stack->setCurrentIndex(1); // show profile

I guess this is Qt6? Sadly, I am unable to compile with Qt6.

Could you perhaps try this:

diff --git a/desktop-widgets/profilewidget.cpp b/desktop-widgets/
profilewidget.cpp
index 9582d1bba..ab40a81b1 100644
--- a/desktop-widgets/profilewidget.cpp
+++ b/desktop-widgets/profilewidget.cpp
@@ -198,13 +198,13 @@ void ProfileWidget::plotCurrentDive()
 
 	setEnabledToolbar(current_dive != nullptr);
 	if (editedDive) {
-		setDive(originalDive);
 		view->plotDive(editedDive.get(), editedDc);
+		setDive(originalDive);
 	} else if (current_dive) {
-		setDive(current_dive);
 		view->setProfileState(current_dive, dc_number);
 		view->resetZoom(); // when switching dive, reset the 
zoomLevel
 		view->plotDive(current_dive, dc_number);
+		setDive(current_dive);
 	} else {
 		view->clear();
 		stack->setCurrentIndex(0);
@@ -235,8 +235,8 @@ void ProfileWidget::divesChanged(const QVector<dive *> 
&dives, DiveField field)
 void ProfileWidget::setPlanState(const struct dive *d, int dc)
 {
 	exitEditMode();
-	setDive(d);
 	view->setPlanState(d, dc);
+	setDive(d);
 }
 
 void ProfileWidget::unsetProfHR()

Thanks,

Berthold




More information about the subsurface mailing list