have you tried using a different function to draw chars? (just to see if it
is that specific function?), try
void MyWinDrawChars(void* str,UInt16 len,Coord x,Coord y){
UInt32 op=WinSetDrawMode(winPaint);
WinPaintChars((Char*)str,len,x,y);
WinSetDrawMode(op);
}
does that crash too? if so, is it on the WinPaintChars call or one of the
other calls?
Also the window you're drawing on is valid?
Does adding a small delay after call to WinDrawChars help?
On 12/12/06, Harry <[EMAIL PROTECTED]> wrote:
>
> 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/
>
--
Best Regards, Dmitry Grinberg
Software Engineer, http://PalmPowerups.com
(847) 226 9295
AIM: DmitryGrinberg
MSN: [EMAIL PROTECTED]
ICQ: 165589894
Y! IM: dmitrygr2003
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/