Skip to content

Fix bug in Fortran dataset destructor #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/c/c_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ extern "C" SRError DeallocateDataSet(void** dataset)
DataSet* d = reinterpret_cast<DataSet*>(*dataset);
delete d;
*dataset = NULL;
dataset = NULL;
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/fortran/dataset.F90
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ subroutine final_destructor(self)
type(dataset_type), intent(inout) :: self
integer :: code

if (c_associated(self%dataset_ptr)) code = dataset_deconstructor(self%dataset_ptr)
! if (c_associated(self%dataset_ptr)) code = dataset_deconstructor(self%dataset_ptr)
end subroutine final_destructor

!> Destroy the dataset
Expand Down
7 changes: 6 additions & 1 deletion tests/fortran/client_test_dataset.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ program main
integer :: ndims

integer :: i, j, k
type(dataset_type) :: dataset
type(dataset_type) :: dataset, retrieved_dataset
type(client_type) :: client

integer :: err_code
Expand Down Expand Up @@ -239,6 +239,11 @@ program main
if (result .ne. SRNoError) error stop
if (.not. exists) error stop 'existent dataset: FAILED'

! Test retrieval of dataset
print *, retrieved_dataset%dataset_ptr
result = client%get_dataset("test_dataset", retrieved_dataset)
print *, retrieved_dataset%dataset_ptr


write(*,*) "Fortran Dataset: passed"

Expand Down
Loading