From 1dc39827d610f6d390c0eacb0e59bbb3f84cff0f Mon Sep 17 00:00:00 2001
From: MALFREYT <alexandre.malfreyt@synchrotron-soleil.fr>
Date: Tue, 22 Apr 2025 18:33:50 +0200
Subject: [PATCH] fix: move SingleShotAOManager construction to dtart of
 init_device to allow init after an error in get_device_property()

---
 src/SingleShotAO.cpp | 47 ++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp
index 19b614b..e101a12 100755
--- a/src/SingleShotAO.cpp
+++ b/src/SingleShotAO.cpp
@@ -231,6 +231,30 @@ void SingleShotAO::init_device()
 	//- trace/profile this method
 	yat4tango::TraceHelper t("SingleShotAO::init_device", this);
 
+	// construct the AO manager
+	//--------------------------------------------
+	try
+	{
+		m_manager = new SingleShotAOManager(this);
+	}
+	catch (...)
+	{
+		ERROR_STREAM << "initialization failed - failed to create manager" << std::endl;
+		m_currStatus = "initialization failed [failed to create manager]. See log for details";
+		m_state = Tango::FAULT;
+		return;
+	}
+
+	// test the manager
+	if (!m_manager)
+	{
+		ERROR_STREAM << "initialization failed - the manager is not created" << std::endl;
+		m_currStatus = "initialization failed [the manager is not created]. See log for details";
+		m_state = Tango::FAULT;
+		return;
+	}
+	
+
 	// Initialise variables to default values
 	//--------------------------------------------
 
@@ -320,29 +344,6 @@ void SingleShotAO::init_device()
 
 	INFO_STREAM << "Board has " << m_nb_chan << " channels" << endl;
 
-	// construct the AO manager
-	//--------------------------------------------
-	try
-	{
-		m_manager = new SingleShotAOManager(this);
-	}
-	catch (...)
-	{
-		ERROR_STREAM << "initialization failed - failed to create manager" << std::endl;
-		m_currStatus = "initialization failed [failed to create manager]. See log for details";
-		m_state = Tango::FAULT;
-		return;
-	}
-
-	// test the manager
-	if (!m_manager)
-	{
-		ERROR_STREAM << "initialization failed - the manager is not created" << std::endl;
-		m_currStatus = "initialization failed [the manager is not created]. See log for details";
-		m_state = Tango::FAULT;
-		return;
-	}
-
 
 	// get frequency value in database
 	//--------------------------------------------
-- 
GitLab