From: Daniel Arndt Date: Sun, 5 Mar 2017 15:50:36 +0000 (+0100) Subject: Catch throwing function in destructor X-Git-Tag: v8.5.0-rc1~52^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8a81c0b3b21ee7f87d480891cffb73fb238769;p=dealii.git Catch throwing function in destructor --- diff --git a/include/deal.II/lac/block_matrix_base.h b/include/deal.II/lac/block_matrix_base.h index e1647c2e58..179a8e0071 100644 --- a/include/deal.II/lac/block_matrix_base.h +++ b/include/deal.II/lac/block_matrix_base.h @@ -1495,7 +1495,12 @@ template inline BlockMatrixBase::~BlockMatrixBase () { - clear (); + try + { + clear (); + } + catch (...) + {} } diff --git a/include/deal.II/lac/vector_memory.h b/include/deal.II/lac/vector_memory.h index 72fd8edf16..0c3278f608 100644 --- a/include/deal.II/lac/vector_memory.h +++ b/include/deal.II/lac/vector_memory.h @@ -368,7 +368,12 @@ template inline VectorMemory::Pointer::~Pointer() { - pool->free(v); + try + { + pool->free(v); + } + catch (...) + {} } diff --git a/source/base/timer.cc b/source/base/timer.cc index eea4331a26..6530c3662a 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -353,8 +353,13 @@ TimerOutput::TimerOutput (MPI_Comm mpi_communicator, TimerOutput::~TimerOutput() { - while (active_sections.size() > 0) - leave_subsection(); + try + { + while (active_sections.size() > 0) + leave_subsection(); + } + catch (...) + {} if ( (output_frequency == summary || output_frequency == every_call_and_summary) && output_is_enabled == true) diff --git a/source/lac/block_sparsity_pattern.cc b/source/lac/block_sparsity_pattern.cc index d1f30cc1db..5660af3c6b 100644 --- a/source/lac/block_sparsity_pattern.cc +++ b/source/lac/block_sparsity_pattern.cc @@ -64,7 +64,12 @@ template BlockSparsityPatternBase::~BlockSparsityPatternBase () { // clear all memory - reinit (0,0); + try + { + reinit (0,0); + } + catch (...) + {} } diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 5711041fa8..6f38dc05fe 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -37,7 +37,12 @@ namespace PETScWrappers PreconditionerBase::~PreconditionerBase () { - clear(); + try + { + clear(); + } + catch (...) + {} } void diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 392c5dd282..178e0fe4f9 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -206,7 +206,8 @@ namespace PETScWrappers #else const PetscErrorCode ierr = VecDestroy (&vector); #endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); + AssertNothrow (ierr == 0, ExcPETScError(ierr)); + (void) ierr; } } diff --git a/source/lac/trilinos_block_sparse_matrix.cc b/source/lac/trilinos_block_sparse_matrix.cc index 1b6d80151c..d8544acd21 100644 --- a/source/lac/trilinos_block_sparse_matrix.cc +++ b/source/lac/trilinos_block_sparse_matrix.cc @@ -33,7 +33,12 @@ namespace TrilinosWrappers { // delete previous content of // the subobjects array - clear (); + try + { + clear (); + } + catch (...) + {} } diff --git a/source/numerics/time_dependent.cc b/source/numerics/time_dependent.cc index c54537a732..7ebda7256b 100644 --- a/source/numerics/time_dependent.cc +++ b/source/numerics/time_dependent.cc @@ -51,8 +51,13 @@ TimeDependent::TimeDependent (const TimeSteppingData &data_primal, TimeDependent::~TimeDependent () { - while (timesteps.size() != 0) - delete_timestep (0); + try + { + while (timesteps.size() != 0) + delete_timestep (0); + } + catch (...) + {} }