-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.2
-
x86
-
windows_nt
Name: skT88420 Date: 01/03/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-001, native threads, symcjit)
This report is similar/identical to 4238890, 4252946, 4236062, 4200425.
Because the problem is not fixed in any publicly available release
(1.3beta has similar behaviour), we report it again with a suggested
fix, which seems to work successfully.
Problem description: a high rate of updates for an array of JTextFields
causes the JVM to crash with an access violation
The error can be reproduced with the example code BugTest.java
given below (this is a reduced example from bug report 4238890).
The error is best reproduced on dual-CPU WinNT machines.
Solaris machines are not affected since the bugs are in the
Windows-AWT sources. Single CPU WinNT machines show the same behavior
but it takes much longer for the JVM to crash.
Bugs:
1.) In the class AwtSharedDC the variable m_useCount is not properly
guarded against use from different threads (e.g. Attach and Detach
at the same time).
The count is sometimes not updated correctly, which leads to premature
disposal of the SharedDC!!
Fixed with a shared lock.
2.) In the class AwtGraphics the destructor uses the shared DC without
locking it!! This is a problem when the garbage collector thread is
disposing
the object, while there is a screen update.
Fixed by acquiring the lock before resetting it.
3.) In the class AwtGraphics, GdiFlush was used in the wrong places.
GdiFlush has to be called after the thread finished all its operations
and not before, because GdiFlush is threadspecific.
Fixed by adding GdiFlushes in the right places. (not tested yet how
important this fix is).
What we need:
- please verify the bugs
- integrate the fixes in the next JDK / JRE release
- provide Deutsche Bank with a patched version of the JRE 1.2 within
the next 5 business days.
===BugTest.java===CUT HERE===========================
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
class BugTest extends JFrame
implements ActionListener
{
private int counter=0;
private Timer timer= null;
private int rows=5;
private int cols=5;
private JTextField[] inTexts;
public BugTest()
{
setTitle("JavaTest");
setSize(1000, 400);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ System.exit(0);
}
} );
JPanel loPanel1 = new JPanel();
loPanel1.setLayout(new GridLayout(rows,cols,5,5));
inTexts = new JTextField[rows*cols];
for (int loIdx=0;loIdx<inTexts.length;loIdx++)
{
inTexts[loIdx] = new JTextField();
inTexts[loIdx].setEditable(false);
inTexts[loIdx].setHorizontalAlignment(JTextField.CENTER);
loPanel1.add(inTexts[loIdx]);
}
getContentPane().add(loPanel1);
timer=new Timer (1,this);
timer.setRepeats(true);
timer.start();
}
public void actionPerformed(ActionEvent evt)
{
for (int i=0;i<inTexts.length;i++)
{
inTexts[i].setText("Counter: " +(counter++));
}
}
public static void main(String[] args)
{
BugTest loFrame = new BugTest();
loFrame.show();
}
}
(Review ID: 99508)
======================================================================
- duplicates
-
JDK-4045781 exposed/damaged canvases don't always update correctly on win32
- Resolved