]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Work around a change in PETSc 3.4.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 24 Sep 2013 18:12:47 +0000 (18:12 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 24 Sep 2013 18:12:47 +0000 (18:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@30916 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_matrix_base.cc

index fb96b311eb4ce3e7b7a6d3dec09dd3e3a4ff7541..81780da99d92e45529d987efede62f95c9e2e87c 100644 (file)
@@ -358,13 +358,16 @@ namespace PETScWrappers
     ierr = MatGetRow(*this, row, &ncols, &colnums, &values);
     AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr));
 
-    // then restore the matrix and return the
-    // number of columns in this row as
-    // queried previously
+    // then restore the matrix and return the number of columns in this row as
+    // queried previously. Starting with PETSc 3.4, MatRestoreRow actually
+    // resets the last three arguments to zero/NULL, to avoid abuse of pointers
+    // now dangling. as a consequence, we need to save the size of the array
+    // and return the saved value.
+    const PetscInt ncols_saved = ncols;
     ierr = MatRestoreRow(*this, row, &ncols, &colnums, &values);
     AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr));
 
-    return ncols;
+    return ncols_saved;
   }
 
 

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.