RFR: 8275033: Drag and drop a file produces NullPointerException Cannot read field "dragboard"
Kevin Rushforth
kcr at openjdk.org
Fri Jan 20 23:19:16 UTC 2023
On Fri, 20 Jan 2023 20:35:07 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> When running on Wayland the `GDK_DRAG_LEAVE` is sent just after `GDK_DROP_START`. The leave event causes java to set `dragGesture` to `null`. On Xorg this event is not sent.
>>
>> The fix just ignores the leave event if a drop occurred.
>
> modules/javafx.graphics/src/main/native-glass/gtk/glass_dnd.cpp line 141:
>
>> 139: jobjectArray mimes;
>> 140: gint dx, dy;
>> 141: } enter_ctx = {NULL, FALSE, FALSE, NULL, 0, 0};
>
> it's funny how it's initialized here and also in reset_enter_ctx(), and just by coincidence both produce the same result. This will break if initial values are other than NULL, 0, FALSE.
Indeed. During my review, before I looked more closely, I was all ready to post a comment to the effect that it was never set back to FALSE. Then I saw the `memset` in `reset_enter_ctx` that you referred to. Not the way I would have initially designed it -- relying on '0' being the desired default value for all fields (including pointers) -- but given that it is that way, this doesn't make the problem any worse.
-------------
PR: https://git.openjdk.org/jfx/pull/1005
More information about the openjfx-dev
mailing list