~openjdk/openjdk/openjdk7

« back to all changes in this revision

Viewing changes to patches/sec-webrev-8u131-8167110-jdk.patch

  • Committer: Matthias Klose
  • Date: 2017-08-23 15:57:01 UTC
  • Revision ID: doko@ubuntu.com-20170823155701-t1c08fbzkt3isvf1
 - 7u151-2.6.11 upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# HG changeset patch
2
 
# User mcherkas
3
 
# Date 1485286789 -10800
4
 
#      Tue Jan 24 22:39:49 2017 +0300
5
 
# Node ID 95fd1952637bd6e55987579efc6de3d061681c83
6
 
# Parent  4a42e488b516948631aa2c07cd0cbd7f343d4b0f
7
 
8167110: Windows peering issue
8
 
7155957: closed/java/awt/MenuBar/MenuBarStress1/MenuBarStress1.java hangs on win 64 bit with jdk8
9
 
8079595: Resizing dialog which is JWindow parent makes JVM crash
10
 
8147842: IME Composition Window is displayed at incorrect location
11
 
Reviewed-by: serb
12
 
 
13
 
--- openjdk/jdk/src/share/classes/java/awt/Menu.java.orig
14
 
+++ openjdk/jdk/src/share/classes/java/awt/Menu.java
15
 
@@ -411,9 +411,9 @@ public class Menu extends MenuItem imple
16
 
             items.removeElementAt(index);
17
 
             MenuPeer peer = (MenuPeer)this.peer;
18
 
             if (peer != null) {
19
 
+                peer.delItem(index);
20
 
                 mi.removeNotify();
21
 
                 mi.parent = null;
22
 
-                peer.delItem(index);
23
 
             }
24
 
         }
25
 
     }
26
 
--- openjdk/jdk/src/share/classes/java/awt/MenuBar.java.orig
27
 
+++ openjdk/jdk/src/share/classes/java/awt/MenuBar.java
28
 
@@ -222,7 +222,6 @@ public class MenuBar extends MenuCompone
29
 
             if (m.parent != null) {
30
 
                 m.parent.remove(m);
31
 
             }
32
 
-            menus.addElement(m);
33
 
             m.parent = this;
34
 
 
35
 
             MenuBarPeer peer = (MenuBarPeer)this.peer;
36
 
@@ -232,6 +231,7 @@ public class MenuBar extends MenuCompone
37
 
                 }
38
 
                 peer.addMenu(m);
39
 
             }
40
 
+            menus.addElement(m);
41
 
             return m;
42
 
         }
43
 
     }
44
 
@@ -248,9 +248,9 @@ public class MenuBar extends MenuCompone
45
 
             menus.removeElementAt(index);
46
 
             MenuBarPeer peer = (MenuBarPeer)this.peer;
47
 
             if (peer != null) {
48
 
+                peer.delMenu(index);
49
 
                 m.removeNotify();
50
 
                 m.parent = null;
51
 
-                peer.delMenu(index);
52
 
             }
53
 
         }
54
 
     }
55
 
--- openjdk/jdk/src/share/classes/java/awt/MenuComponent.java.orig
56
 
+++ openjdk/jdk/src/share/classes/java/awt/MenuComponent.java
57
 
@@ -75,7 +75,7 @@ public abstract class MenuComponent impl
58
 
      * @see #setFont(Font)
59
 
      * @see #getFont()
60
 
      */
61
 
-    Font font;
62
 
+    volatile Font font;
63
 
 
64
 
     /**
65
 
      * The menu component's name, which defaults to <code>null</code>.
66
 
@@ -292,11 +292,13 @@ public abstract class MenuComponent impl
67
 
      * @see       java.awt.font.TextAttribute
68
 
      */
69
 
     public void setFont(Font f) {
70
 
-        font = f;
71
 
-        //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font)
72
 
-        MenuComponentPeer peer = (MenuComponentPeer)this.peer;
73
 
-        if (peer != null) {
74
 
-            peer.setFont(f);
75
 
+        synchronized (getTreeLock()) {
76
 
+            font = f;
77
 
+            //Fixed 6312943: NullPointerException in method MenuComponent.setFont(Font)
78
 
+            MenuComponentPeer peer = (MenuComponentPeer)this.peer;
79
 
+            if (peer != null) {
80
 
+                peer.setFont(f);
81
 
+            }
82
 
         }
83
 
     }
84
 
 
85
 
--- /dev/null
86
 
+++ openjdk/jdk/test/java/awt/Frame/FrameResize/ShowChildWhileResizingTest.java
87
 
@@ -0,0 +1,88 @@
88
 
+/*
89
 
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
90
 
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
91
 
+ *
92
 
+ * This code is free software; you can redistribute it and/or modify it
93
 
+ * under the terms of the GNU General Public License version 2 only, as
94
 
+ * published by the Free Software Foundation.
95
 
+ *
96
 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
97
 
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
98
 
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
99
 
+ * version 2 for more details (a copy is included in the LICENSE file that
100
 
+ * accompanied this code).
101
 
+ *
102
 
+ * You should have received a copy of the GNU General Public License version
103
 
+ * 2 along with this work; if not, write to the Free Software Foundation,
104
 
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
105
 
+ *
106
 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
107
 
+ * or visit www.oracle.com if you need additional information or have any
108
 
+ * questions.
109
 
+ */
110
 
+
111
 
+/* @test
112
 
+   @bug 8079595
113
 
+   @summary Resizing dialog which is JWindow parent makes JVM crash
114
 
+   @author Semyon Sadetsky
115
 
+  */
116
 
+
117
 
+import javax.swing.*;
118
 
+import java.awt.*;
119
 
+import java.awt.event.ActionEvent;
120
 
+import java.awt.event.ActionListener;
121
 
+import java.awt.event.InputEvent;
122
 
+
123
 
+public class ShowChildWhileResizingTest {
124
 
+
125
 
+    private static Window dialog;
126
 
+    private static Timer timer;
127
 
+    private static Point point;
128
 
+
129
 
+    public static void main(String[] args) throws Exception {
130
 
+        dialog = new Frame();
131
 
+        dialog.add(new JPanel());
132
 
+        dialog.setVisible(true);
133
 
+        dialog.setBounds(100, 100, 200, 200);
134
 
+        SwingUtilities.invokeAndWait(new Runnable() {
135
 
+            @Override
136
 
+            public void run() {
137
 
+                final Window dependentWindow = new JWindow(dialog);
138
 
+                JPanel panel = new JPanel();
139
 
+                panel.add(new JButton("button"));
140
 
+                dependentWindow.add(panel);
141
 
+                dependentWindow.setVisible(true);
142
 
+                dependentWindow.setBounds(0, 0, 50, 50);
143
 
+                timer = new Timer(100, new ActionListener() {
144
 
+                    @Override
145
 
+                    public void actionPerformed(ActionEvent e) {
146
 
+                        dependentWindow
147
 
+                                .setVisible(!dependentWindow.isVisible());
148
 
+                    }
149
 
+                });
150
 
+                timer.start();
151
 
+            }
152
 
+
153
 
+        });
154
 
+
155
 
+        Robot robot = new Robot();
156
 
+        robot.setAutoDelay(5);
157
 
+        robot.delay(300);
158
 
+        SwingUtilities.invokeAndWait(new Runnable() {
159
 
+            @Override
160
 
+            public void run() {
161
 
+                point = dialog.getLocationOnScreen();
162
 
+            }
163
 
+        });
164
 
+        robot.mouseMove(point.x + 200 - dialog.getInsets().right/2,
165
 
+                point.y + 200 - dialog.getInsets().bottom/2);
166
 
+        robot.mousePress(InputEvent.BUTTON1_MASK);
167
 
+        for(int i = 0; i < 100; i++) {
168
 
+            robot.mouseMove(point.x + 200 + i, point.y + 200 + i);
169
 
+        }
170
 
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
171
 
+        timer.stop();
172
 
+        dialog.dispose();
173
 
+        System.out.println("ok");
174
 
+    }
175
 
+}