Skip to content

Commit

Permalink
correction to file closing in the class destructor routine
Browse files Browse the repository at this point in the history
  • Loading branch information
marcdegraef committed Feb 29, 2024
1 parent d697682 commit cc20d43
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Source/EMsoftOOLib/mod_povray.f90
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,19 @@ subroutine PoVRay_destructor(self)

call reportDestructor('PoVRay_T')

! if the file unit is still open, close it here
if (self%dunit.ne.0) then
inquire(unit=self%dunit, opened=itsopen)
! the following lines were commented out because the destructor routine
! gets called, for some reason, before the complete file has been written
! so the file is closed too early...

if (itsopen.eqv..TRUE.) then
close(unit=self%dunit, status='keep')
call Message%printMessage(' Closed PoVray file '//trim(self%filename))
end if
end if
! if the file unit is still open, close it here
! if (self%dunit.ne.0) then
! inquire(unit=self%dunit, opened=itsopen)

! if (itsopen.eqv..TRUE.) then
! close(unit=self%dunit, status='keep')
! call Message%printMessage(' Closed PoVray file '//trim(self%filename))
! end if
! end if

end subroutine PoVRay_destructor

Expand Down

0 comments on commit cc20d43

Please sign in to comment.