diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java index 440a65ddec3..a0841af43e4 100644 --- a/jdk/src/share/classes/java/awt/Window.java +++ b/jdk/src/share/classes/java/awt/Window.java @@ -1,5 +1,5 @@ /* - * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1995-2008 Sun Microsystems, Inc. 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 @@ -24,7 +24,6 @@ */ package java.awt; -import java.applet.Applet; import java.awt.event.*; import java.awt.im.InputContext; import java.awt.image.BufferStrategy; @@ -355,18 +354,21 @@ public class Window extends Container implements Accessible { static class WindowDisposerRecord implements sun.java2d.DisposerRecord { final WeakReference owner; final WeakReference weakThis; - final AppContext context; + final WeakReference context; WindowDisposerRecord(AppContext context, Window victim) { owner = new WeakReference(victim.getOwner()); weakThis = victim.weakThis; - this.context = context; + this.context = new WeakReference(context); } public void dispose() { Window parent = owner.get(); if (parent != null) { parent.removeOwnedWindow(weakThis); } - Window.removeFromWindowList(context, weakThis); + AppContext ac = context.get(); + if (null != ac) { + Window.removeFromWindowList(ac, weakThis); + } } }