I have an application where I perform calculations in a thread. Since some of the calculations can be lengthy I have added the ability to kill the thread from the user interface. When testing, the application will silently crash about one in four times when I kill the thread. I have included part of the crash log below. Funny thing is that I have a similar application and it does not seem to crash. Only real difference is the calculation being done in the thread. All code in the thread is pure Xojo (no plugins or dylib calls). What could be causing the crash??
Process: APMInt.debug [477]
Path: /Users/USER/Desktop/*/APMInt.debug.app/Contents/MacOS/APMInt.debug
Identifier: com.apmathsoft.apmint
Version: ??? (1.2.0.3.0)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: APMInt.debug [477]
User ID: 501
Date/Time: 2015-04-06 23:00:12.191 -0500
OS Version: Mac OS X 10.10.2 (14C1514)
Report Version: 11
Anonymous UUID: 58B378C7-E6E9-BBAD-7981-B02B2271E0C8
Time Awake Since Boot: 53 seconds
Crashed Thread: 12
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000b05aaa80
VM Regions Near 0xb05aaa80:
Stack 00000000b0527000-00000000b05a8000 [ 516K] rw-/rwx SM=COW
-->
Stack 00000000bc000000-00000000bf800000 [ 56.0M] ---/rwx SM=NUL
Thread 12 Crashed:
0 com.xojo.XojoFramework 0x00480238 rnd + 4326
1 com.xojo.XojoFramework 0x004f874c RuntimeRaiseException + 305
2 com.xojo.XojoFramework 0x004a7ce5 RuntimeSwapPStringLocks + 2007
3 com.xojo.XojoFramework 0x0050e9c7 StringFromCFString + 386
4 com.xojo.XojoFramework 0x0045280c RuntimeBackgroundTask + 35
5 com.apmathsoft.apmint 0x00296f4b apmint_module.apmint_fft_rdft_all%%i8i8p + 212493
6 com.apmathsoft.apmint 0x002dbd75 apmint_module.apmint_fft_multiply%o<apmint_module.apmint>%o<apmint_module.apmint>o<apmint_module.apmint> + 8247
7 com.apmathsoft.apmint 0x00308092 apmint_module.apmint.factorial%o<apmint_module.apmint>%o<apmint_module.apmint> + 6868
8 com.apmathsoft.apmint 0x00237cc8 WindowCalc_Integer.WindowCalc_Integer.thread_action%%o<WindowCalc_Integer.WindowCalc_Integer>o<Thread> + 11749
9 com.apmathsoft.apmint 0x0023f2a1 Delegate.IM_Invoke%%o<Thread> + 83
10 com.apmathsoft.apmint 0x0023f242 AddHandler.Stub.0%% + 51
11 com.xojo.XojoFramework 0x0050fc51 threadRun + 909
12 libsystem_pthread.dylib 0x9956ee13 _pthread_body + 138
13 libsystem_pthread.dylib 0x9956ed89 _pthread_start + 162
14 libsystem_pthread.dylib 0x9956ce52 thread_start + 34
Thread 12 crashed with X86 Thread State (32-bit):
eax: 0x00005088 ebx: 0x002d9cf2 ecx: 0x020c4810 edx: 0x00000411
edi: 0xb05a59f8 esi: 0xb059aa6c ebp: 0xb059a9b8 esp: 0xb059a990
ss: 0x00000023 efl: 0x00010206 eip: 0x00480238 cs: 0x0000001b
ds: 0x00000023 es: 0x00000023 fs: 0x00000023 gs: 0x0000000f
cr2: 0xb05aaa80
Logical CPU: 0
Error Code: 0x00000006
Trap Number: 14