]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix issues reported by Coverity 5744/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 17 Jan 2018 13:00:09 +0000 (14:00 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 17 Jan 2018 21:01:17 +0000 (22:01 +0100)
include/deal.II/lac/block_sparse_matrix.templates.h
include/deal.II/lac/swappable_vector.templates.h
source/grid/tria.cc
source/numerics/time_dependent.cc

index 01bae4345fa294e3eade1208e3c57d62afe09760..0b6a0f6b23dbe9bd8d52426558f94d027d4e5f0f 100644 (file)
@@ -37,7 +37,12 @@ BlockSparseMatrix<number>::~BlockSparseMatrix ()
 {
   // delete previous content of
   // the subobjects array
-  clear ();
+  try
+    {
+      clear ();
+    }
+  catch (...)
+    {}
   sparsity_pattern = nullptr;
 }
 
index 08d64e7e8fc577b0f5a9750401561d50a2f8ec39..84dd2fa51a167a0f0dafea7d1e14a9a2fdc07f7f 100644 (file)
@@ -54,7 +54,14 @@ SwappableVector<number>::~SwappableVector ()
   // itself
 
   if (filename != "")
-    kill_file ();
+    {
+      try
+        {
+          kill_file ();
+        }
+      catch (...)
+        {}
+    }
 }
 
 
index 8ff8460535464013e2ffa2f8e46ccbd5190d82d6..e0ee6ecfbd9ac97e23fc77a3255c05f8a7554ae2 100644 (file)
@@ -4022,12 +4022,6 @@ namespace internal
                 // user flag is set or not
                 cell->clear_user_flag();
 
-                // An assert to make sure that the static_cast in the
-                // next line has the chance to give reasonable
-                // results.
-                Assert(cell->material_id()<= std::numeric_limits<types::material_id>::max(),
-                       ExcIndexRange(cell->material_id(),0,std::numeric_limits<types::material_id>::max()));
-
                 // new vertex is placed on the surface according to
                 // the information stored in the boundary class
                 triangulation.vertices[next_unused_vertex] =
@@ -8896,17 +8890,17 @@ Triangulation<dim, spacedim>::~Triangulation ()
   // 1d. double check this here, as destruction is a good place to
   // ensure that what we've done over the course of the lifetime of
   // this object makes sense
-  Assert ((dim == 1)
-          ||
-          (vertex_to_boundary_id_map_1d == nullptr),
-          ExcInternalError());
+  AssertNothrow ((dim == 1)
+                 ||
+                 (vertex_to_boundary_id_map_1d == nullptr),
+                 ExcInternalError());
 
   // the vertex_to_manifold_id_map_1d field should be also unused
   // except in 1d. check this as well
-  Assert ((dim == 1)
-          ||
-          (vertex_to_manifold_id_map_1d == nullptr),
-          ExcInternalError());
+  AssertNothrow ((dim == 1)
+                 ||
+                 (vertex_to_manifold_id_map_1d == nullptr),
+                 ExcInternalError());
 }
 
 
index 517c8b3059b37f2b79056c641c7e6594c403f0ec..f4a8ecddc25f4a3615dd0b4089927581a6dd45d0 100644 (file)
@@ -444,7 +444,7 @@ TimeStepBase_Tria<dim>::~TimeStepBase_Tria ()
       delete t;
     }
   else
-    Assert (tria==nullptr, ExcInternalError());
+    AssertNothrow (tria==nullptr, ExcInternalError());
 
   coarse_grid = nullptr;
 }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.