< prev index next >

modules/graphics/src/main/native-iio/jpegloader.c

Print this page
rev 8884 : RT-28705: JNI warnings in javafx-iio

@@ -585,24 +585,32 @@
     char buffer[JMSG_LENGTH_MAX];
     jstring string;
     imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
     JNIEnv *env = (JNIEnv *) GetEnv(jvm, JNI_VERSION_1_2);
     jobject theObject;
+    j_decompress_ptr dinfo;
 
     /* Create the message */
     (*cinfo->err->format_message) (cinfo, buffer);
 
+    if (cinfo->is_decompressor) {
+        dinfo = (j_decompress_ptr)cinfo;
+        RELEASE_ARRAYS(env, data, dinfo->src->next_input_byte);
+    }
     // Create a new java string from the message
     string = (*env)->NewStringUTF(env, buffer);
 
     theObject = data->imageIOobj;
 
     if (cinfo->is_decompressor) {
         (*env)->CallVoidMethod(env, theObject,
                 JPEGImageLoader_emitWarningID,
                 string);
         checkAndClearException(env);
+        if (!GET_ARRAYS(env, data, &(dinfo->src->next_input_byte))) {
+            cinfo->err->error_exit(cinfo);
+        }
     }
 }
 
 /* End of verbatim copy from jpegdecoder.c */
 
< prev index next >