Hi all,

I am testing the new version of a multi-segment app and observe very rare and 
erratic crashes in the following code:


Char message[] = "some text constant";
UInt16 len = StrLen( message );
RectangleType rect;
...
WinSetDrawMode( winOverlay );
...
WinDrawRectangleFrame( simpleFrame, &rect );
WinPaintChars( message, len, rect.topLeft.x + (rect.extent.x - 
FntCharsWidth(message, len))/2, rect.topLeft.y + (rect.extent.y - 
FntLineHeight())/2 - 1 );


The WinPaintChars() statement draws some text in the middle of a rectangle and 
does so as expected for maybe a 100 times, sometimes a 10,000 times before 
behaving completely erratic in either of the 3 ways:
a) freezing the device
b) throwing a Fatal Exception
c) just *erasing* little rectangles from the background instead of painting the 
characters (but no freeze or exception)

I have checked with the debugger the validity of message, len and the 
surrounding rectangle (all drawing and painting done in kCoordinatesNative).

>From cases a) and b) I can infer that it is WinPaintChars() that bombs (as the 
>frame is drawn but the text does not get painted before the device hangs).

Once case c) occurs, it keeps reoccurring every time the code is executed, i.e. 
it becomes a stable state in this segment. If I switch to annother form in 
another segment, WinPaintChars() behaves as expected; switching back to the 
first segment with the code seen above produces case c) again. Finally, if I 
quit and re-launch the application, everything is fine again for the next 100 
or 10,000 calls of the code.

Weird, isn't it?
Any ideas and hints to a fix or workaround will be highly appreciated!

Harry

I am using CW 9.3 on Win/XP

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to