8198000: java/awt/List/EmptyListEventTest/EmptyListEventTest.java debug assert on Windows

Reviewed-by: prr, serb
This commit is contained in:
Ambarish Rapte 2018-11-09 12:08:05 +05:30
parent e40a70bce0
commit 3ec1c6f949
2 changed files with 17 additions and 11 deletions

View File

@ -478,8 +478,12 @@ BOOL AwtList::IsFocusingMouseMessage(MSG *pMsg)
MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic)
{
if (IsFocusingMouseMessage(msg)) {
LONG count = GetCount();
if (count > 0) {
LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam));
if (item != LB_ERR) {
if (HIWORD(item) == 0) {
item = LOWORD(item);
if (item >= 0 && item < count) {
if (isMultiSelect) {
if (IsItemSelected(item)) {
Deselect(item);
@ -490,6 +494,8 @@ MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic)
Select(item);
}
}
}
}
delete msg;
return mrConsume;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
/*
* @test
* @key headful
* @bug 6366126
* @bug 6366126 8198000
* @summary List throws ArrayIndexOutOfBoundsException when pressing ENTER after removing all the items, Win32
* @author Dmitry Cherepanov area=awt.list
* @run main EmptyListEventTest