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

assertion failure because of operation on invalid DC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • 2d
    • beta
    • x86
    • windows_nt



      Name: dsC76792 Date: 03/06/2000

      ###@###.###

      The following test case fails with AWT assertion on the debug build of
      JDK1.4.0alpha-B with classic VM:

      -----------------------------------------------------------------------
      import java.awt.*;
      import java.awt.event.*;

      public class Test extends WindowAdapter implements ActionListener {
          
          final Frame frame = new Frame("Test frame");
          final Button button = new Button("Show Dialog");

          public static void main(String[] args) {
      Test test = new Test();
          }

          public Test() {
              button.addActionListener(this);
              frame.add(button);
              frame.pack();
              frame.addWindowListener(this);
              frame.setVisible(true);
          }

          public void windowClosing(WindowEvent e) {
              Window window = (Window)e.getSource();
              window.dispose();
          }

          public void actionPerformed(ActionEvent e) {
              Dialog dialog = new Dialog(frame);
              dialog.addWindowListener(this);
              dialog.setVisible(true);
          }
      }
      -----------------------------------------------------------------------

      Run the test.
      A frame with a button appears.
      Press the button.
      A dialog appears.
      Close the dialog.
      Press the button again.
      A dialog appears.
      AWT assertion failure message is issued.

      Here is the output:
      -----------------------------------------------------------------------
      I:\bug\b4030718\modal>J:\jdk1.4\win32\bin\java_g -classic -version
      java version "1.4.0alpha"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0alpha-B)
      Classic VM (build java_re, native threads, nojit)

      I:\bug\b4030718\modal>J:\jdk1.4\win32\bin\java_g -classic Test
      *********************
      AWT Assertion Failure
      *********************
      ::GetObjectType(hDC) == OBJ_DC
      File '..\..\..\..\src\win32\native\sun\windows\awt_Component.cpp', at line 828
      GetLastError() is 0 : The operation completed successfully.

      Do you want to break into the debugger?
      *********************
      *********************
      AWT Assertion Failure
      *********************
      ::ReleaseDC(GetHWnd(), hDC) != 0
      File '..\..\..\..\src\win32\native\sun\windows\awt_Component.cpp', at line 829
      GetLastError() is 0 : The operation completed successfully.

      Do you want to break into the debugger?
      *********************
      -----------------------------------------------------------------------

      This problem was likely introduced with a recent 2d integration.
      Win32SD_GetDC() function caches DC handle in lastgc.hdc field.
      After the window for the cached DC is destroyed this DC becomes
      invalid but is still referenced from lastgc structure. Assertion
      fails when we try to release the invalid DC.

      ======================================================================

            tdv Dmitri Trembovetski (Inactive)
            dassunw Das Das (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: