I am shipping my apps in 64-bit now, but I have some reports about strange crashes. Here is an example crash report:
[quote]
Process: Goldfish 4 [486]
Path: /Applications/Goldfish 4.app/Contents/MacOS/Goldfish 4
Identifier: com.fishbeam.goldfish4
Version: 4.1 (4.1.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Goldfish 4 [486]
User ID: 501
(…)
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x00007fff92d88cc4 CFRetain + 180
1 com.xojo.XojoFramework 0x0000000106da43d2 0x106d27000 + 512978
2 com.xojo.XojoFramework 0x0000000106da7391 0x106d27000 + 525201
3 com.xojo.XojoFramework 0x0000000106da91cf RuntimeStringCompare + 75
4 com.xojo.XojoFramework 0x0000000106f034cd VariantCompare + 169
5 com.fishbeam.goldfish4 0x0000000105d5a49d claMedia.DuplicateMedia%i8%ooi8 + 8525
6 com.fishbeam.goldfish4 0x0000000105e3537c claItemPicture.Event_Duplicate%o%oooo + 1260
7 com.fishbeam.goldfish4 0x0000000105afbe73 claPageItem.CallDuplicate%o%ooooi8 + 371
8 com.fishbeam.goldfish4 0x0000000105a4bfb4 claPageArea.PasteFromClipBoard%%o + 2532
9 com.fishbeam.goldfish4 0x00000001059c3728 claPageArea.Event_MenuEditPaste%b%o + 1336
10 com.fishbeam.goldfish4 0x0000000105bc371e claEditorPart.CallMenuEditPaste%b%o + 94
11 com.fishbeam.goldfish4 0x0000000105b9f7fa claEditor._EditPaste_Action%b%o + 202
…[/quote]
64-bit apps seam to crash if you do string comparisons with large strings and in my case that have no TextEncoding. The code that crashes is this:
//Check if media was added before
For i=0 To ToMedia.Media.Count-1
If ToMedia.Media.Value(ToMedia.Media.Key(i))=Media.Value(Key) Then //Compare raw binary data of images, movie files etc.
Found=True
Exit
End If
Next
I could fix that with just comparing the hash of the strings instead of the strings themselves:
//Check if media was added before
For i=0 To ToMedia.Media.Count-1
If Md5(ToMedia.Media.Value(ToMedia.Media.Key(i)).StringValue)=Md5(Media.Value(Key).StringValue) Then //No crash here
Found=True
Exit
End If
Next
But now I have a crash report from a Japanese customer where this code always crashes. In this case with short strings:
[code]//s is the binary data without TextEncoding of an image file
//Open SVG
If LeftB(s, 5)="<?xml" Then
(…) //Open SVG code
//Open GIF
ElseIf LeftB(s, 3)=“GIF” Then
p=GifStringToPictureMBS(s)
…[/code]
Again it crashes at the string comparison with binary data but this time the string is short and the bug not reproducible for me, because on my system this code works in 64-bit.
Has anyone discovered similar crashes with RuntimeStringCompare on 64-bit systems? And how did you fix that? Maybe I could try my hash-trick, but unfortunately I can not test that on my computer.