On Mon, 7 Aug 2023 23:33:37 GMT, Alexander Matveev <[email protected]> wrote:
> - Fixed by checking for `NULL` pointer after memory allocation.
> - In `NativeVideoBuffer` `std::nothrow` was added when allocating `jint`
> array, so `new` will return `NULL` instead of throwing exception. This done
> for consistency and also it is not clear how well JNI handles C++ exceptions
> in this case and what value will Java code get if exception is thrown.
modules/javafx.media/src/main/native/jfxmedia/jni/NativeAudioSpectrum.cpp line
58:
> 56: CAudioSpectrum *pSpectrum = (CAudioSpectrum*)jlong_to_ptr(nativeRef);
> 57: CJavaBandsHolder *pHolder = new (std::nothrow) CJavaBandsHolder();
> 58: if (pHolder == NULL) {
I see more than one occurrence of (std::nothrow) in the code base where the
return value is not checked for NULL (directwrite.cpp, GlassAccessible.cpp,
GlassTextRangeProvider.cpp - I did not check beyond *.c* wildcard though, so
could be more).
Do we want to add a null check there?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1204#discussion_r1293723731