-
Bug
-
Resolution: Fixed
-
P4
-
1.1, 1.1.3, 1.1.4, 1.1.5, 1.2.0
-
b01
-
generic, x86
-
generic, windows_95, windows_nt
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2018968 | 1.2.0 | Robi Khan | P4 | Closed | Fixed | 1.2fcs |
Name: ccC48265 Date: 02/06/98
When a Dialog is closed, the c++ object associated with the Dialog may be freed
and reallocated before the thread that calls ShowModal() is activated.
ShowModal() assumes that the object is still usable and calls SetStyle().
To prevent this race condition, the HWND should be stored in a local variable,
before the thread is suspended, so that the c++ object is not required.
The HWND may be invalid by the time it is used but Windows deals with this
safely.
New code in awt_Dialog
void AwtDialog::ShowModal()
{
/* Save the hwnd on the stack, so that if the c++ object is deleted
** before this thread is woken up, we don't try to get the hwnd from freed
** up memory
*/
HWND hwnd = GetHWnd();
:
:
// Remove modal styles set before show, incase next show is non-modal
::SetWindowLong(hwnd, GWL_STYLE,
::GetWindowLong(hwnd, GWL_STYLE) & ~DS_MODALFRAME);
if (IS_WIN4X) {
DWORD exStyle = ::GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_DLGMODALFRAME;
::SetWindowLong(hwnd, GWL_EXSTYLE, exStyle);
}
}
The SetWindowLong(hwnd, GWL_STYLE replaces the SetStyle/GetStyle() code. Note
that GetHWnd() has been replaced by hwnd.
(Review ID: 24580)
======================================================================
- backported by
-
JDK-2018968 620661: RACE CONDITION IN AWT_DIALOG SHOWMODAL()
-
- Closed
-
- duplicates
-
JDK-4162267 SwingSet dialogs destroys app on Windows NT with JDK-1.2fcs-D
-
- Closed
-
-
JDK-4053877 JVM crashes when disposing of a dialog
-
- Closed
-
-
JDK-4100907 602328:FILEDIALOG NOT MODAL WHEN ANOTHER MODAL DIALOG IS RUNNING
-
- Closed
-