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

Scrollbar.setValues(int,int,int,int) causes application to freeze

    XMLWordPrintable

Details

    • b01
    • x86
    • solaris_2.5.1, windows_95, windows_nt
    • Not verified

    Description







      Name: mc57594 Date: 02/10/97


      This problem shows up on all Beta Versions of jdk1.1
      When scrolling the GUI the application will freeze at the point
      that it attempts to do a Scrollbar.setValues(....).

      No ErrorMessages are produced.
      ----------------------------------------------------------
      --- here is some example code that causes the problem..
      a more elaborate example is at
       http://day.acl.lanl.gov/edb/classes/GanttChartViewer.java
      -----------------------------------------------------------
      import java.awt.*;
      import java.util.*;
      import java.io.*;
      import java.net.*;
      import TM_tools.*;

      public class scrollTest extends Frame
      {
      Button cancel;
      Button login;
          URL base;
      Label title;
      RaisedPanel header;
      Scrollbar blowup;
      Panel footer;



      GridBagLayout gridbag = new GridBagLayout();


          public scrollTest(URL doc_base)
          {
      super("jdk11 scrolltest");


      setLayout(gridbag);
              base = doc_base;
      header = new RaisedPanel();
      footer = new Panel();

      blowup = new Scrollbar(0,0,64,0,255);

      header.setLayout(gridbag);
      footer.setLayout(gridbag);

      header.setForeground(new Color(250,250,250));
              header.setBackground(new Color(50,100,225));

      cancel = new Button("Cancel");
      login = new Button("OK");

      title = new Label("Authentication Information",Label.CENTER);
      title.setFont(new Font("Dialog",Font.PLAIN,16));





      HorizontalRule hr = new HorizontalRule();



      constrain(header,title,
                              0,0,GridBagConstraints.REMAINDER,1,
                              GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,
                              1.0,0,0,0,0,0);
      /*-----------------------------------------------------*/

      constrain(footer,login,
                              0,0,
      1,1,
                              GridBagConstraints.NONE,GridBagConstraints.CENTER,
                              0,0,0,0,0,0);
              constrain(footer,cancel,
                              1,0,
      1,1,
                              GridBagConstraints.NONE,GridBagConstraints.CENTER,
                              0,0,0,0,0,0);
      /*-----------------------------------------------------*/
      constrain(this,header,
                              0,0,
                              2,1,
                              GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTH,
                              1.0,0,2,2,2,2);

      constrain(this,new Label("Scrollbar:",Label.RIGHT),
                              0,1,
                              1,1,
                              GridBagConstraints.BOTH,GridBagConstraints.CENTER,
                              1.0,1.0,2,2,2,2);
      constrain(this,blowup,
                              1,1,
                              1,1,
                              GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,
                              1.0,1.0,2,2,2,10);


              constrain(this,hr,
                              0,2,
                              2,1,
                              GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,
                              1.0,0,2,2,2,2);
      constrain(this,footer,
                              0,3,
      2,1,
                              GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,
                              1.0,0,2,2,2,2);



      pack();
      show();
          }
          public void constrain(Container container, Component component,
      int grid_x, int grid_y, int grid_width, int grid_height,
      int fill, int anchor, double weight_x, double weight_y,
      int top, int left, int bottom, int right)
          {
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = grid_x;
      c.gridy = grid_y;
      c.gridwidth = grid_width;
      c.gridheight = grid_height;
      c.fill = fill;
      c.anchor = anchor;
      c.weightx = weight_x;
      c.weighty = weight_y;
      if(top+bottom+left+right >0)
      c.insets = new Insets(top, left,bottom, right);
      ((GridBagLayout)container.getLayout()).setConstraints(component,c);
      container.add(component);
          }
          public boolean handleEvent(Event event)
          {
              if(event.target == blowup)
              {
                  blowup.setValues(20,30,0,1000);

                  return true;
              }
           return super.handleEvent(event);
          }

          public boolean action(Event e, Object what)
          {
      if(e.target == cancel)
      {
      this.hide();
      this.dispose();
      System.exit(0);
      }
      if(e.id == Event.WINDOW_DESTROY)
      {
      System.exit(0);
      return super.handleEvent(e);

      }



      return super.action(e,what);;
          }


          public static void main(String [] args)
          {
      scrollTest window;
      URL target;

      try{
      //hack!!!
      target = new URL("http://day.acl.lanl.gov/edb/");
      window = new scrollTest(target);
      }catch(java.net.MalformedURLException e) {
             System.out.println("Check URL.." + e);
      System.exit(0);
           }

          }


      }


      company - Los Alamos National Laboratory , email - ###@###.###
      ======================================================================
      linda.mccolm@Eng 1997-06-06

      investigating

      -----------------------
      From UNKNOWN
      Date: 10 Jun 97 10:41:18
      From: "CJHARRIS.US.ORACLE.COM" <CJHARRIS.US.ORACLE.COM>
      To: ###@###.###
      Subject: Javasoft bug #4031472
      Cc: stom,rchapman,jwolf
      MIME-Version: 1.0

      Attached: Scrollbar.java (named sbar.jav due to email client limitation)
       
      The attached file contains the fix for Javasoft bug #4031472, that has been
      applied to the latest Oracle build, 1.1.1o5. The fix is isolated to this file.
       
      I have modified setValues() so that the Scrollbar's monitor is not held while
      the peer is called. Holding the monitor while calling the peer can lead to a
      deadlock because:
       
      1. setValues() is called from both the Window Thread and the Event Dispatch
      Thread.
       
      2. The peer implementation of setValues sends messages to the scroll bar
      control, resulting in an inter-thread send from the Event Dispatch Thread.
       
      An alternative solution would be to modify the peer to post messages to the
      control instead of sending them but this would mean that the peer control
      would be in an undefined state on return from the call to setValues(). In
      addition posting is less efficient than sending.
       
      Please let me know if you have any questions.
       
      Chris

      Attachments

        Activity

          People

            tballsunw Tom Ball (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: