Skip to content

Commit

Permalink
Merge pull request #562 from jacobwilliams/561-json-file-destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwilliams authored May 28, 2024
2 parents 99106c0 + 42f5649 commit c19763f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/json_file_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ subroutine json_file_load(me, filename, unit)
!! (if not present, a newunit
!! is used)

call me%destroy()
call me%core%load(file=filename, p=me%p, unit=unit)

end subroutine json_file_load
Expand All @@ -875,6 +876,7 @@ subroutine json_file_load_from_string(me, str)
class(json_file),intent(inout) :: me
character(kind=CK,len=*),intent(in) :: str !! string to load JSON data from

call me%destroy()
call me%core%deserialize(me%p, str)

end subroutine json_file_load_from_string
Expand Down Expand Up @@ -1997,7 +1999,7 @@ subroutine json_file_add(me,p,destroy_original)
destroy = .true. ! default
end if

if (destroy) call me%core%destroy(me%p)
if (destroy) call me%destroy()

me%p => p

Expand Down

0 comments on commit c19763f

Please sign in to comment.