From: Wolfgang Bangerth Date: Tue, 24 Sep 2013 18:12:47 +0000 (+0000) Subject: Work around a change in PETSc 3.4. X-Git-Tag: v8.1.0~735 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2be0c6386ffea2a5f240fa75e12635c29918a859;p=dealii.git Work around a change in PETSc 3.4. git-svn-id: https://svn.dealii.org/trunk@30916 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index fb96b311eb..81780da99d 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -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; }