<AWT Dev> [8] Review request for 7124310: [macosx] "opposite" seems always null in focus events

Anthony Petrov anthony.petrov at oracle.com
Thu Nov 1 06:48:22 PDT 2012


Hi Leonid,

src/macosx/classes/sun/lwawt/LWWindowPeer.java
>  686         Window oppositeWindow = (opposite == null)? null : getTarget();

I think this should read "opposite.getTarget()", no?

src/macosx/native/sun/awt/AWTWindow.m
>  60 static AWTWindow* lastKeyWindow = nil;

 From previous experience I can tell you that storing a pointer to an 
ObjC object w/o retaining it is pointless and may lead to bugs that are 
very hard to debug. Please add retain/release calls in the setter for 
this variable.

>  549     AWTWindow *opposite = nil;

>  521         jobject oppositeWindow = [opposite.javaPlatformWindow jObjectWithEnv:env];

At line 549 the opposite may be set to nil, however, at line 512 you're 
accessing it w/o a check for nil.

--
best regards,
Anthony

On 11/01/12 02:43, Leonid Romanov wrote:
> Hi,
> Please review a fix for 7124310: [macosx] "opposite" seems always null
> in focus events. It's not a real bug, but something that hasn't been
> implemented yet: Cocoa focus notifications don't have information about
> "opposite" window, so we have to track it ourselves.
>
> Webrev: http://cr.openjdk.java.net/~leonidr/7124310/webrev.00/
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7124310
>
> Thanks,
> Leonid.



More information about the awt-dev mailing list