From 352a1dfb2cf7ac120458eb84b4e97bcf394afe70 Mon Sep 17 00:00:00 2001 From: Jade PHAM <jade.pham@synchrotron-soleil.fr> Date: Wed, 26 Mar 2025 14:58:07 +0100 Subject: [PATCH] correction of cash in case that no probe connected to mcce --- src/MCCE2Electrometers.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/MCCE2Electrometers.cpp b/src/MCCE2Electrometers.cpp index 63993d8..0bc8222 100644 --- a/src/MCCE2Electrometers.cpp +++ b/src/MCCE2Electrometers.cpp @@ -159,18 +159,6 @@ void MCCE2Electrometers::delete_device() // Delete device allocated objects // Delete device's allocated object - if(this->_electrometerCH1) - { - delete this->_electrometerCH1; - this->_electrometerCH1 = 0; - } - - if(this->_electrometerCH2) - { - delete this->_electrometerCH2; - this->_electrometerCH2 = 0; - } - DELETE_DEVSTRING_ATTRIBUTE(attr_range1_read); DELETE_DEVSTRING_ATTRIBUTE(attr_range2_read); DELETE_SCALAR_ATTRIBUTE(attr_electrometerChannel_read); @@ -520,7 +508,7 @@ void MCCE2Electrometers::write_electrometerChannel(Tango::WAttribute &attr) { WARN_STREAM << "Cannot control electrometer on this channel : seems that nothing is connected on!" << std::endl; // nothing is connected on this channel - *attr_range1_read = &_notConnectedStr[0]; + strcpy(*attr_range1_read,_notConnectedStr.c_str()); } } else if ( w_val == ELETRO_CHANNEL_TWO ) @@ -538,7 +526,7 @@ void MCCE2Electrometers::write_electrometerChannel(Tango::WAttribute &attr) { WARN_STREAM << "Cannot control electrometer on this channel : seems that nothing is connected on!" << std::endl; //- warn nothing is connected on this channel - *attr_range2_read = &_notConnectedStr[0]; + strcpy(*attr_range2_read,_notConnectedStr.c_str()); } } attr_electrometerChannel_write = w_val; @@ -559,7 +547,7 @@ void MCCE2Electrometers::read_range1(Tango::Attribute &attr) /*----- PROTECTED REGION ID(MCCE2Electrometers::read_range1) ENABLED START -----*/ if ( !this->_electrometerCH1 ) { - *attr_range1_read = &_notConnectedStr[0]; + strcpy(*attr_range1_read,_notConnectedStr.c_str()); } else { @@ -589,7 +577,7 @@ void MCCE2Electrometers::read_range2(Tango::Attribute &attr) /*----- PROTECTED REGION ID(MCCE2Electrometers::read_range2) ENABLED START -----*/ if ( !this->_electrometerCH2 ) { - *attr_range2_read = &_notConnectedStr[0]; + strcpy(*attr_range2_read,_notConnectedStr.c_str()); } else { -- GitLab