From eb1bb58c36c3695b68adfd51bcbcdc5e901d2413 Mon Sep 17 00:00:00 2001 From: smathis Date: Fri, 4 Oct 2024 17:03:15 +0200 Subject: [PATCH] Fixed an uninitialized memory bug: In AmorDetectorAxis, the variables det_starting and det_startTime were not initialized before reading them in the poll function, leading to erratic behaviour. --- sinqEPICSApp/src/pmacAxis.cpp | 2 ++ sinqEPICSApp/src/pmacAxis.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sinqEPICSApp/src/pmacAxis.cpp b/sinqEPICSApp/src/pmacAxis.cpp index 39bb41b..e72e1df 100644 --- a/sinqEPICSApp/src/pmacAxis.cpp +++ b/sinqEPICSApp/src/pmacAxis.cpp @@ -1186,6 +1186,8 @@ AmorDetectorAxis::AmorDetectorAxis(pmacController *pC, int axisNo, int function) pC_->debugFlow(functionName); _function = function; + det_starting = false; + det_startTime = time(NULL); callParamCallbacks(); diff --git a/sinqEPICSApp/src/pmacAxis.h b/sinqEPICSApp/src/pmacAxis.h index 0f4f385..a50be05 100644 --- a/sinqEPICSApp/src/pmacAxis.h +++ b/sinqEPICSApp/src/pmacAxis.h @@ -117,7 +117,7 @@ class LiftAxis : public pmacAxis { The default constructor of LiftAxis just forwards to the pmacAxis constructor, which has an optional argument "autoenable" with the default value "true". However, we want that argument to be false, hence we provide - an explicit constructor + an explicit constructor. */ LiftAxis(pmacController *pController, int axisNo) : pmacAxis((pmacController *)pController, axisNo, false) {};