1
1

mpi.Request: avoid calling JNI free if it is null

This commit was SVN r30806.
Этот коммит содержится в:
Oscar Vega-Gisbert 2014-02-24 22:28:59 +00:00
родитель d07d1864ae
Коммит 90625573ff
2 изменённых файлов: 7 добавлений и 17 удалений

Просмотреть файл

@ -79,21 +79,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Request_free(
JNIEnv *env, jobject jthis, jlong handle) JNIEnv *env, jobject jthis, jlong handle)
{ {
MPI_Request req = (MPI_Request)handle; MPI_Request req = (MPI_Request)handle;
int rc = MPI_Request_free(&req);
if(req != MPI_REQUEST_NULL) ompi_java_exceptionCheck(env, rc);
{
if(req == NULL)
{
req = MPI_REQUEST_NULL;
}
else
{
/* Handle is NULL when we create a Prequest object. */
int rc = MPI_Request_free(&req);
ompi_java_exceptionCheck(env, rc);
}
}
return (jlong)req; return (jlong)req;
} }

Просмотреть файл

@ -71,8 +71,11 @@ protected Request(long handle)
*/ */
@Override public void free() throws MPIException @Override public void free() throws MPIException
{ {
MPI.check(); if(!isNull())
handle = free(handle); {
MPI.check();
handle = free(handle);
}
} }
private native long free(long req) throws MPIException; private native long free(long req) throws MPIException;