Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4470152

Change to java.awt.Window.dispose() causes compatibility problem

XMLWordPrintable

    • tiger
    • generic
    • generic



      Name: bsC130419 Date: 06/14/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

      java.awt.Window.dispose() has changed. It used to call java.awt.Window.hide() but now it calls java.awt.Component.setVisible(false) which then calls java.awt.Window.hide(). Unfortunately if a subclass of Window overrides java.awt.Component.setVisible(boolean) the behaviour of the subclass will be
      different when dispose() gets called.

      In my application I have a subclass of Dialog which overrides setVisible
      (boolean) to call dispose() because the dialog was not being disposed of when
      the application was minimised. Under jdk1.3 this was fine but under jdk1.4 I
      get a stack overflow when the dialog is dismissed because dispose() gets into
      an infinite loop. The top part of a stack dump is given below:

      java.lang.StackOverflowError
      at java.awt.Toolkit.getEventQueue(Toolkit.java:1481)
      at java.awt.EventQueue.isDispatchThread(EventQueue.java:564)
      at java.awt.Window.dispose(Window.java:518)
      at java.awt.Dialog.disposeImpl(Dialog.java:560)
      at java.awt.Dialog.dispose(Dialog.java:556)
      at com.aspentech.janet.janetscreen.JanetOOBStatus.closedDialog
      (JanetOOBStatus.java:156)
      at com.aspentech.janet.janetscreen.JanetDialog.setVisible
      (JanetDialog.java:93)
      at java.awt.Window$1$DisposeAction.run(Window.java:506)
      at java.awt.Window.dispose(Window.java:519)
      at java.awt.Dialog.disposeImpl(Dialog.java:560)
      at java.awt.Dialog.dispose(Dialog.java:556)
      at com.aspentech.janet.janetscreen.JanetOOBStatus.closedDialog
      (JanetOOBStatus.java:156)
      at com.aspentech.janet.janetscreen.JanetDialog.setVisible
      (JanetDialog.java:93)
      at java.awt.Window$1$DisposeAction.run(Window.java:506)
      at java.awt.Window.dispose(Window.java:519)
      at java.awt.Dialog.disposeImpl(Dialog.java:560)
      at java.awt.Dialog.dispose(Dialog.java:556)
      at com.aspentech.janet.janetscreen.JanetOOBStatus.closedDialog
      (JanetOOBStatus.java:156)
      at com.aspentech.janet.janetscreen.JanetDialog.setVisible
      (JanetDialog.java:93)
      at java.awt.Window$1$DisposeAction.run(Window.java:506)
      at java.awt.Window.dispose(Window.java:519)
              ..................etc

      I don't see any reason for this change; java.awt.Window.hide() has not been deprecated and in
      fact the intention is still to call the java.awt.Window.hide() method.
      (Review ID: 126600)
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: