RFR: 8307160: Fix AWT/2D/A11Y to support the permissive- flag on the Microsoft Visual C compiler [v46]
Julian Waters
jwaters at openjdk.org
Wed Mar 20 06:25:51 UTC 2024
On Sat, 20 Jan 2024 00:17:02 GMT, Phil Race <prr at openjdk.org> wrote:
>> Julian Waters has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 79 commits:
>>
>> - Merge branch 'openjdk:master' into patch-10
>> - Merge branch 'openjdk:master' into patch-10
>> - Fix awt_Window.cpp
>> - Fix awt_PrintJob.cpp
>> - -Zc:stringStrings no longer needed with -permissive- flags-cflags.m4
>> - Fix awt_Window.cpp
>> - awt_Window.cpp
>> - awt_PrintJob.cpp
>> - awt_Frame.cpp
>> - Whitespace awt_Component.cpp
>> - ... and 69 more: https://git.openjdk.org/jdk/compare/35e96627...cbfbaee6
>
> src/java.desktop/windows/native/libawt/windows/awt_Component.cpp line 6366:
>
>> 6364: jobject parent = data->parentComp;
>> 6365:
>> 6366: AwtComponent *awtComponent = nullptr;
>
> Looking at it (not tested) here through 6403 could be simplified as
>
> if (self == NULL || parent == NULL) {
> env->ExceptionClear();
> JNU_ThrowNullPointerException(env, "peer");
> env->DeleteGlobalRef(self);
> env->DeleteGlobalRef(parent);
> delete data;
> return;
> }
>
> AwtComponent *awtComponent = (AwtComponent *)JNI_GET_PDATA(self);
> if (awtComponent == NULL) {
> THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
> env->DeleteGlobalRef(self);
> env->DeleteGlobalRef(parent);
> delete data;
> return;
> }
>
> AwtComponent *awtParent = (AwtComponent *)JNI_GET_PDATA(parent);
> if (awtParent == NULL) {
> THROW_NULL_PDATA_IF_NOT_DESTROYED(parent);
> env->DeleteGlobalRef(self);
> env->DeleteGlobalRef(parent);
> delete data;
> return;
> }
>
>
> I think I prefer that over
> BOOL error = FALSE;
> AwtComponent *awtComponent = nullptr;
> AwtComponent *awtParent = nullptr;
>
> if (self == NULL || parent == NULL) {
> env->ExceptionClear();
> JNU_ThrowNullPointerException(env, "peer");
> error = TRUE;
> }
>
> if (!error) {
> awtComponent = (AwtComponent *)JNI_GET_PDATA(self);
> if (awtComponent == NULL) {
> THROW_NULL_PDATA_IF_NOT_DESTROYED(self);
> error = TRUE;
> }
> }
>
> if (!error) {
> awtParent = (AwtComponent *)JNI_GET_PDATA(parent);
> if (awtParent == NULL) {
> THROW_NULL_PDATA_IF_NOT_DESTROYED(parent);
> error = TRUE;
> }
>
> if (error) {
> env->DeleteGlobalRef(self);
> env->DeleteGlobalRef(parent);
> delete data;
> return;
> }
Sorry, I don't see a BOOL error anywhere?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15096#discussion_r1531553778
More information about the build-dev
mailing list