That adds what I suggested, but I had also suggested you leave in what you
had added as it also adds some protection.
Additionally I read the MS docs and they do explain the 131071 return value.
The message this code is sending is LB_ITEMFROMPOINT and the docs say here
https://docs.microsoft.com/en-us/windows/desktop/controls/lb-itemfrompoint
that
>The return value contains the index of the nearest item in the
*LOWORD* <https://msdn.microsoft.com/library/windows/desktop/ms632659>.
The *HIWORD*
<https://msdn.microsoft.com/library/windows/desktop/ms632657> is zero if
the > specified point is in the client area of the list box, or one if
it is outside the client area"
You got 131071 which is, in hex 0X1FFFF.
So you got "1" for hi-word, meaning "outside client area" and "-1" for
loword,
meaning the index. And a return index of "-1" doubtless means an error ..
-phil.
On 10/31/18 12:49 PM, Ambarish Rapte wrote:
Hi Phil & Sergey,
This issue was introduced with the fix for JDK-6806217
<https://bugs.openjdk.java.net/browse/JDK-6806217>, in 7b55, which
modified AwtList::HandleEvent(), so It was not observed with JDK6.
Please review the updated change as discussed offline:
http://cr.openjdk.java.net/~arapte/8198000/webrev.01/
Regards,
Ambarish
*From:*Phil Race
*Sent:* Tuesday, October 30, 2018 2:09 AM
*To:* Ambarish Rapte <ambarish.ra...@oracle.com>; awt-dev@openjdk.java.net
*Subject:* Re: <AWT Dev> [12] RFR : JDK-8198000 :
java/awt/List/EmptyListEventTest/EmptyListEventTest.java debug assert
on Windows
On 10/29/18 7:31 AM, Ambarish Rapte wrote:
Hi,
Please review this Windows only fix,
JBS: https://bugs.openjdk.java.net/browse/JDK-8198000
Webrev:
http://cr.openjdk.java.net/~arapte/8198000/webrev.00/
Issue:
1. Test asserts with debug build jdk, only on windows.
Only the debug build turns on asserts.
But I think JDK 6 always turned on asserts, and this test was
introduced in 6,
so something must have changed else we'd have seen this test fail a
long time ago.
Can you identify what it was ?
Also same comment as the other bug - you need to add the bug id to the
test.
2.
3. Assert at Line no 77, awt_List.h :: IsItemSelected()
4. awt_List.cpp :: AwtList::HandleEvent() calls
IsItemSelected() with an incorrect index value.
Why ?
5.
6. In AwtList::HandleEvent() , the call
SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam) returns an
arbitrary value 131071, which gets passed to IsItemSelected().
7. Could not find any relevance to the value 131071, from
LB_ITEMFROMPOINT doc.
That is (128*1024)-1, so it is probably not "arbitrary".
Please add the eval above to the bug report .. once we have a complete
understanding.
-phil.
8.
Fix: Index should be verified before making call to
IsItemSelected() :
http://cr.openjdk.java.net/~arapte/8198000/webrev.00/
Verification: All list tests pass.
Regards,
Ambarish