FIX: QuickWin Copying Large Selection Causes GP FaultLast reviewed: September 16, 1997Article ID: Q86068 |
5.10 | 5.10
MS-DOS | OS/2
kbprg kbfixlist kbbuglist kberrmsg
The information in this article applies to:
SYMPTOMSRunning a QuickWin application created by Microsoft FORTRAN version 5.1 for MS-DOS and OS/2 that outputs a large quantity of output to a child window, and then selecting a large amount of the output and choosing Copy from the Edit menu, may cause a general protection (GP) fault under Windows 3.1 or an unrecoverable application error (UAE) under Windows 3.0. If a smaller (yet still large) region is selected, a dialog box may be generated with the following error:
QWIN Warning Out of Memory CAUSEThe Copy menu item does a call to the Windows GlobalAlloc() API to allocate memory from the global heap. QuickWin applications calculate the size of the allocation by using a RECT Windows structure containing the dimensions of the selection. The elements of this structure are only 2-byte integers and when a very large region of text is selected, the integer values overflow. The resulting handle returned from the GlobalAlloc() function is invalid. The subsequent attempt to use the allocated memory causes a GP fault. The QWIN Warning dialog box is generated when the size of the selection is small enough to not overflow the integer elements of the RECT structure but too big for GlobalAlloc() to succeed.
RESOLUTIONDo not attempt to copy extremely large areas of text in a QuickWin application child window at one time. Select and copy smaller regions.
STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and Windows. This problem was corrected in FORTRAN PowerStation.
MORE INFORMATION
Sample Codec The following code reproduces the problem:
CHARACTER*30 Out INTEGER i Out = '123456789012345678901234567890' OPEN (1, FILE='USER') DO i=1,1000 WRITE (1,*) i, Out, Out END DO ENDc Run the above code and choose Select All from the Edit menu, then c choose Copy or Copy Tabs from the Edit menu to generate the general c protection fault. Decrease the loop to only 500 iterations and the c application will generate the QWIN Warning Out of Memory dialog box c when Select All and then Copy is performed. Note that the text must be written to an explicitly opened child window. If it is written to UNIT * then it will scroll off at the top of the window and the window will never contain sufficient information to reproduce the error.
|
Additional reference words: 5.10 gp-fault
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |