From dec5ec5699bbd04c806015cb71e53f5f9cbd97db Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 6 Aug 2013 11:10:32 +0100 Subject: [PATCH] Fix SEGV on close with TrainTool->Stop() .. casting the sidebar in TrainView was wrong because the controls are in the sidebar, not the trainTool. Thus it would crash on exit .. but strangely only on Mac! .. the code now correctly calls trainTool->Stop(), quite why it fails on Mac only is a bit of a mystery. --- src/TrainSidebar.cpp | 1 - src/Views.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/TrainSidebar.cpp b/src/TrainSidebar.cpp index 31ba05c24..19e81b2f1 100644 --- a/src/TrainSidebar.cpp +++ b/src/TrainSidebar.cpp @@ -922,7 +922,6 @@ void TrainSidebar::Pause() // pause capture to recalibrate void TrainSidebar::Stop(int deviceStatus) // when stop button is pressed { - if ((status&RT_RUNNING) == 0) return; status &= ~(RT_RUNNING|RT_PAUSED); diff --git a/src/Views.cpp b/src/Views.cpp index 53566a086..7f52089bc 100644 --- a/src/Views.cpp +++ b/src/Views.cpp @@ -179,7 +179,7 @@ TrainView::~TrainView() void TrainView::close() { - static_cast(sidebar())->Stop(); + trainTool->Stop(); p->close(); }