Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-11

fpc 2.4.2rc1 for Mac crashing in AnsiCompareText

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

Has anyone been experiencing this one?

AnsiCompareText is crashing everywhere for me:

procedure TOPSkins.FillChairInfo(ASkinName: string; AChairIndex,
AChairCount: Integer;
  var ASeat: TSeatModel);
begin
..
  // First fill size and button position
  // From Skins/Chairs/
  if AnsiCompareText(ASkinName, 'Chair01') = 0 then

With:

Breakpoint 1, 0x000210ff in fpc_raiseexception ()
(gdb) bt
#0 0x000210ff in fpc_raiseexception ()
#1 0x000bd434 in SYSUTILS_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER () #2 0x000250d8 in SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER () #3 0x00031cd7 in CTHREADS_CENTERCRITICALSECTION$formal () #4 0x00027a66 in SYSTEM_ENTERCRITICALSECTION$TRTLCRITICALSECTION () #5 0x000ed282 in CWSTRING_ANSICOMPARETEXT$ANSISTRING$ANSISTRING$$LONGINT () #6 0x00060f1c in TOPSKINS__FILLCHAIRINFO (ASKINNAME=0x397eb4, ACHAIRINDEX=0, ACHAIRCOUNT=8, ASEAT={CHAIRCENTERPOS = {X = 0, Y = 0}, CHAIRPOS = {X = 0, Y = 0}, CHAIRSIZE = {CX = 0, CY = 0}, CHAIRBUTTONPOS = {X = 0, Y = 0}, CHIPSPOS = {X = 0, Y = 0}, CHAIRMIRROREDX = false, CHAIRMIRROREDY = false, SEATHINT = 0x0, POTPOS = {X = 0, Y = 0}, CARDPLACE = {X = 0, Y = 0}, SEATSTATUS = SSVACANT, AVATAR = {NICKNAME = 0x0, INPLAYAMOUNT = 0x0, LOCATION = 0x0, STATUS = 0x0}, HAND = 0x0, BET = {VALUE = 0x0, PILES = {0x0, 0x0, 0x0, 0x0}}}, this=0x27ed2c0) at opcskins.pas:1628

The object is valid, and the same code works perfectly in Windows. I don't remember any crashes like that with fpc 2.4.1 previously, but unfortunately I threw away my fpc 2.4.1 installer. FPC 2.4.0 can't be used with this project because jpeg crashes.

I tryed to remove the use of AnsiCompareText from my code, but then it just crashes inside the LCL in places where AnsiCompareText is used =(

Even in trivial code such as creating a component:

Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000094 0x000268c5 in SYSTEM_WAITFREE_FIXED$PMEMCHUNK_FIXED$POSCHUNK () (gdb) bt
#0 0x000268c5 in SYSTEM_WAITFREE_FIXED$PMEMCHUNK_FIXED$POSCHUNK () #1 0x00026989 in
SYSTEM_SYSFREEMEM_FIXED$PFREELISTS$PMEMCHUNK_FIXED$$LONGWORD () #2 0x000ebc2d in CWSTRING_ANSICOMPARETEXT$ANSISTRING$ANSISTRING$$LONGINT () #3 0x000adefb in
CLASSES_TSTRINGLIST_$__DOCOMPARETEXT$ANSISTRING$ANSISTRING$$LONGINT () #4 0x001815b0 in TLCLCOMPONENT__NEWINSTANCE (pvmt=0x4a32f0 <VMT_CUSTOMDRAWNEXTRAS_TBITMAPPEDBUTTON>) at lclclasses.pp:118 #5 0x00294208 in TCUSTOMBITMAPPEDBUTTON__CREATE (AOWNER=0x0, vmt=0x4a32f0, this=0x0) at customdrawnextras.pas:313

I also tryed to remove the use of cwstrings from the LCL via define, but it still crashes with the same stack. Is the unit mandatory in Mac?

bye,

Felipe Monteiro de Carvalho

Reply by email

Jonas Maebe
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
Has anyone been experiencing this one? AnsiCompareText is crashing everywhere for me:

I'm not aware of any problems with it. We have a test for it that works fine: http://svn.freepascal.org/svn/fpc/trunk/tests/test/units/sysutils/tastrcmp.pp

The object is valid, and the same code works perfectly in Windows. I don't remember any crashes like that with fpc 2.4.1 previously, but unfortunately I threw away my fpc 2.4.1 installer. FPC 2.4.0 can't be used with this project because jpeg crashes.

Nothing has been changed to that code compared to FPC 2.4.0. You probably have a memory corruption issue in your program. The fact that it works fine on another platform does not mean that you do not have a bug in your code.

I also tryed to remove the use of cwstrings from the LCL via define, but it still crashes with the same stack. Is the unit mandatory in Mac?

The unit is not automatically included by the compiler or RTL in programs on Mac OS X, if that's what you mean. It probably appears in the uses clause of another unit that your are using (or in your main program).

It is however required on Mac OS X to be able to work with widestrings that contain anything else than plain ASCII.

Jonas

Reply by email

Felipe Monteiro de Carvalho
to Jonas Maebe

Hello,

I was using a slightly wrong define, now that I removed cwstrings from the LCL the game runs normally.

But it seams that you are correct, I found the revision which triggered this, but it is a quite large one, so I am trying to see what exactly is the issue. Still, it is strange that it works normally without cwstrings...

thanks,

Felipe Monteiro de Carvalho

Reply by email