diff --git a/eo/src/mpi/eoMpi.h b/eo/src/mpi/eoMpi.h index 92c2ba99..ae004fa1 100644 --- a/eo/src/mpi/eoMpi.h +++ b/eo/src/mpi/eoMpi.h @@ -447,10 +447,53 @@ namespace eo IsFinishedFunction & isFinished() { return *_iff; } // Setters - void sendTask( SendTaskFunction* stf ) { _stf = stf; } - void handleResponse( HandleResponseFunction* hrf ) { _hrf = hrf; } - void processTask( ProcessTaskFunction* ptf ) { _ptf = ptf; } - void isFinished( IsFinishedFunction* iff ) { _iff = iff; } + void sendTask( SendTaskFunction* stf ) + { + if( !stf ) + return; + + if( _stf && _stf->needDelete() ) + { + delete _stf; + } + _stf = stf; + } + + void handleResponse( HandleResponseFunction* hrf ) + { + if( !hrf ) + return; + + if( _hrf && _hrf->needDelete() ) + { + delete _hrf; + } + _hrf = hrf; + } + + void processTask( ProcessTaskFunction* ptf ) + { + if( !ptf ) + return; + + if( _ptf && _ptf->needDelete() ) + { + delete _ptf; + } + _ptf = ptf; + } + + void isFinished( IsFinishedFunction* iff ) + { + if( !iff ) + return; + + if( _iff && _iff->needDelete() ) + { + delete _iff; + } + _iff = iff; + } /** * @brief Helpers for wrapping send task functor. diff --git a/eo/src/mpi/eoMultiStart.h b/eo/src/mpi/eoMultiStart.h index 61936494..b8455e68 100644 --- a/eo/src/mpi/eoMultiStart.h +++ b/eo/src/mpi/eoMultiStart.h @@ -397,7 +397,7 @@ namespace eo /************************************** * DEFAULT RESET ALGO IMPLEMENTATIONS * - ************************************** + **************************************/ /** * @brief For a Genetic Algorithm, reinits the population by copying the original one