changeset 53504:d09e1ab4bd1d

8198001: java/awt/Menu/WrongParentAfterRemoveMenu/WrongParentAfterRemoveMenu.java debug assert on Windows Reviewed-by: prr, serb
author arapte
date Fri, 02 Nov 2018 23:05:47 +0530
parents 45a5c4d812d9
children 814c49afb1a7
files src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp test/jdk/java/awt/Menu/WrongParentAfterRemoveMenu/WrongParentAfterRemoveMenu.java
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp	Thu Nov 01 13:56:14 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp	Fri Nov 02 23:05:47 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -206,7 +206,10 @@
  * this function must be called to draw the changed menu bar.
  */
 void AwtMenuBar::RedrawMenuBar() {
-    VERIFY(::DrawMenuBar(GetOwnerHWnd()));
+    HWND hOwnerWnd = GetOwnerHWnd();
+    if (hOwnerWnd != NULL) {
+        VERIFY(::DrawMenuBar(hOwnerWnd));
+    }
 }
 
 void AwtMenuBar::_AddMenu(void *param)
--- a/test/jdk/java/awt/Menu/WrongParentAfterRemoveMenu/WrongParentAfterRemoveMenu.java	Thu Nov 01 13:56:14 2018 -0700
+++ b/test/jdk/java/awt/Menu/WrongParentAfterRemoveMenu/WrongParentAfterRemoveMenu.java	Fri Nov 02 23:05:47 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -29,7 +29,7 @@
 
 /**
  * @test
- * @bug 8165769
+ * @bug 8165769 8198001
  * @key headful
  */
 public final class WrongParentAfterRemoveMenu {