[fpc-pascal] Carbon: GetTextExtentPoint and Access Violation (major show stopper)
Bent Normann Olsen
bent at earmaster.com
Thu Jun 26 10:56:21 CEST 2008
Hi,
I've posted this issue on the Lazarus mailing list few weeks ago, and no
breakthroughs. On the other hand, I suspect this problem could as well have
to do with FPC handling strings.
I am using FPC v2.2.0 [2008/05/29] for i386 with Mac OS X v10.4.11. And this
problem doesn't appear on the Win32 version.
At certain points our (large) application crashes, like when a control is
about to show a hint, it raises an exception class 'External:
EXC_BAD_ACCESS':
The following debug message says "Execution paused":
Adress: $0000D589
Procedure: SYSTEM_TOBJECT_$__INHERITSFROM$TCLASS$$BOOLEAN
File:
and breaks at line 1725 in carbonwinapi.inc:
if not CheckDC(DC, 'GetTextExtentPoint') then Exit;
I've no clue as to why it breaks at this line, and I traced the exact crash
point to line 1582 in control.inc:
Dispatch(TheMessage)
The GetTextExtentPoint is actually called 6 times with the same string and
no problems, and the Dispatch is called twice after the 6th time with no
problems, but crashes at the 3rd call to Dispatch.
The TheMessage has the following parameters:
{MSG=66592, WPARAM=265482992, LPARAM=0, RESULT=0, WPARAMLO=62192,
WPARAMHI=4050, LPARAMLO=0, LPARAMHI=0, RESULTLO=0, RESULTHI=0}
The MSG is LM_PAINT and WPARAM is the DC.
Note: If I let another control show its hint first, it doesn't crash if the
control shows its hint - it only crash every time when it's the first
control to show its hint. It also crashes on some controls painting strings,
but not with other identical controls with different text.
I can't reproduce the crash on a test program, so I suspect it has to do
with large applications with tons of strings.
It doesn't crash randomly, but changing a string and recompile the
application can make it crash in a different control.
Could FPC have troubles handling strings? And should I change our handlings
of strings to a certain type of strings before setting text properties of
controls?
Any clue or help is much appreciated.
Best regards,
Normann
More information about the fpc-pascal
mailing list