Skip to content

Commit f4127c7

Browse files
hansonrhansonr
authored andcommitted
JSMouse, JSDialog fix
corrects Java Exception in JSMouse caused by missing check for bdata existence corrects code in JSDialog that called parent.addNotify() every time, not just before it has been connected.
1 parent 5a59be0 commit f4127c7

File tree

7 files changed

+6
-7
lines changed

7 files changed

+6
-7
lines changed
44 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190814182015
1+
20190816123836
44 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190814182015
1+
20190816123836
44 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/JSDialog.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,9 @@ protected String constructComponentName() {
690690
public void addNotify() {
691691
synchronized (getTreeLock()) {
692692
getOrCreatePeer();
693-
if (parent != null) {
694-
parent.addNotify();
695-
}
696-
super.addNotify();
693+
if (parent != null && parent.getPeer() == null)
694+
parent.addNotify();
695+
super.addNotify();
697696
}
698697
}
699698

sources/net.sf.j2s.java.core/src/swingjs/JSMouse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public static void checkConsume(InputEvent e) {
467467

468468

469469
public static JComponent getJ2SEventTarget(MouseEvent e) {
470-
return /** @j2sNative e.bdata.source || */null;
470+
return /** @j2sNative e.bdata && e.bdata.source || */null;
471471
}
472472

473473
private static boolean isPopupTrigger(int id, int mods, boolean isWin) {

0 commit comments

Comments
 (0)