SUGGESTED FIX
--- WWindowPeer.java 2007-06-25 14:40:18.000000000 +0400
***************
*** 455,463 ****
appContext.put(ACTIVE_WINDOWS_KEY, l);
}
WWindowPeer wp = (WWindowPeer)w.getPeer();
! // add/move wp to the end of the list
! l.remove(wp);
! l.add(wp);
}
}
}
--- 455,466 ----
appContext.put(ACTIVE_WINDOWS_KEY, l);
}
WWindowPeer wp = (WWindowPeer)w.getPeer();
! // it's possible that active window has already its peer destroyed
! if (wp != null) {
! // add/move wp to the end of the list
! l.remove(wp);
! l.add(wp);
! }
}
}
}
|
EVALUATION
While looking at the bug, I found quite another issue: 'activeWindow' property of KeyboardFocusManager is not changed when any native dialog is activated. I'll file a separate bug about this.
As for the NPE described, the problem is that 'activeWindow' property change may be sent by KFM when the window peer is already destroyed. After this strange propertyChange, 'null' is added to the list of activated windows and causes the NPE with a subsequent call to getActiveWindowHandles. See suggested fix for details.
|