Help porting an application from windows to mac

I have a medium size application that runs on my PC-Windows without any problem.
It had worked for many years on Mac as well, but suddenly I`ve found a very weird thing.

When I open a large example the application on my Mac crashes silently. Both compiled and debugging.
After some time (when something crashes silently it is difficult to debug) I detected the line that produces de crash:


It’s the line with the Breakpoint.
But curiously this line has been used twice before with no problem.
When the application crashes on the line “If LecturaArxiuInterropuda then” the only thing I have is the report to be sent to Apple.
This report is very long but it begins with:

Unfortunately this report says nothing to me, but my hope is that somebody can find something in it that helps me to know what is happening.
Can anyone say something to me about this?
Thanks in advance.

Please post the part of the cash log where it says “Thread 6”. You only posted “Thread 0”.

1 Like

Is LecturaArxiuInterropuda a method ? Does it contain any declare ?

Thank you Beatrix,
With your reply I understood some things:
-The problem is about Threads. Obviously, I knew it, their behaviour is different in Mac and in Windows, so now I can understand why nothing happens in Windows.
-The strange thing is this only happens with a large example, but probably it is due to the fact that as it takes longer reading the file, things happen in the code and threads.
Anyway, the number of the thread that crashes changes, so I am sending you the one about thread 4 which ia the one that crashed this time.
Don’t spend too much time on it. I know that there is a problem about threads and that’s enough for me by now.
Thanks again.

Thread 4 Crashed:
0 libGL.dylib 0x00007fff6ba424d2 glDeleteLists + 17
1 WinTess3Mac.debug 0x0000000103a398e7 OpenGL.glDeleteLists%%i8i8 + 39
2 WinTess3Mac.debug 0x00000001048fd127 moCalculs.CarreguesInicials + 2743 (/moCalculs:426)
3 WinTess3Mac.debug 0x0000000103e0b0dd moWINTESS.ActualitzaEstructura + 605 (/moWINTESS:17)
4 WinTess3Mac.debug 0x0000000103ad9bc0 moArxius.LlegirDadesArxiu%%o + 16176 (/moArxius:1556)
5 XojoFramework 0x000000010547a423 0x105204000 + 2581539
6 XojoFramework 0x0000000105339e18 0x105204000 + 1269272
7 libsystem_pthread.dylib 0x00007fff203348fc _pthread_start + 224
8 libsystem_pthread.dylib 0x00007fff20330443 thread_start + 15

Thread 4 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x000000000000138a rcx: 0x0000000000000000 rdx: 0x0000000000000001
rdi: 0x000000000000138a rsi: 0x000000000000138a rbp: 0x0000700006fe05a0 rsp: 0x0000700006fe05a0
r8: 0x0000000000002240 r9: 0x0000000000000040 r10: 0x00000000000007fb r11: 0x00000f9c65a49e28
r12: 0x0000600003e3e1c0 r13: 0x0000600002d12d00 r14: 0x0000000000000001 r15: 0x00000001055f01b8
rip: 0x00007fff6ba424d2 rfl: 0x0000000000010206 cr2: 0x0000000000000000

Logical CPU: 0
Error Code: 0x00000004 (no mapping for user data read)
Trap Number: 14

Thread 4 instruction stream:
41 89 c8 89 d1 89 f2 89-fe 44 8b 55 10 44 8b 5d A…D.U.D.]
18 65 48 8b 1c 25 f0 00-00 00 48 8b 3b 48 83 ec .eH…%…H.;H…
08 41 53 41 52 50 ff 93-c8 01 00 00 48 83 c4 28 .ASARP…H…(
5b 5d c3 55 48 89 e5 89-fe 65 48 8b 04 25 f0 00 [].UH…eH…%…
00 00 48 8b 38 48 8b 80-d0 01 00 00 5d ff e0 55 …H.8H…]…U
48 89 e5 89 f2 89 fe 65-48 8b 04 25 f0 00 00 00 H…eH…%…
[48]8b 38 48 8b 80 d8 01-00 00 5d ff e0 55 48 89 H.8H…]…UH. <==
e5 48 89 f2 89 fe 65 48-8b 04 25 f0 00 00 00 48 .H…eH…%…H
8b 38 48 8b 80 e0 01 00-00 5d ff e0 55 48 89 e5 .8H…]…UH…
89 fe 65 48 8b 04 25 f0-00 00 00 48 8b 38 48 8b …eH…%…H.8H.
80 e8 01 00 00 5d ff e0-55 48 89 e5 89 fe 65 48 …]…UH…eH
8b 04 25 f0 00 00 00 48-8b 38 48 8b 80 f0 01 00 …%…H.8H…

Thread 4 last branch register state not available.

Binary Images:
0x1038a1000 - 0x104df1fff +WinTess3Mac.debug (0) <36E250B6-0762-3D7A-AF3D-7D4ACF99BD23> /Users/USER//WinTess3Mac.debug.app/Contents/MacOS/WinTess3Mac.debug
0x105204000 - 0x10558bfff +XojoFramework (0) /Users/USER/
/WinTess3Mac.debug.app/Contents/Frameworks/XojoFramework.framework/Versions/A/XojoFramework
0x108c77000 - 0x108c7afff +Shell.dylib (0) <44D6B132-8DF1-368F-8897-FFC08DA7135B> /Users/USER/*/

Thanks Michel,

“LecturaArxiuInterropuda” is a Boolean variable which in this case is False, so the If clause is not executed.

Maybe its a problem with bugs in OpenGL - as OpenGL was deprecated with macOS 10.14 (“Mojave”), I don’t expect Apple to do any bugfixing in that area.

“OpenGL was deprecated in macOS 10.14. To create high-performance code on GPUs, use the Metal framework instead.” [ OpenGL Programming Guide for Mac]

Thanks Thomas,
Anything is possible.
Although the strange thing is it happens only with a large example. Normal examples don’t show this problem.
But anyway, if the problem is OpenGL, I don’t mind. I can’t change the whole program.
Besides, more than 90% of the users are Windows users and (at least at the moment, who knows in the future) there is no problem in Windows.

I don’t see how reading a simple boolean can create a crash. Perhaps the crash is immediately before, immediately after, within the logical if/end if.

Unless your boolean is a computed property.

The bad access error has to do with input output. Do you have any at the same time ? The crashed thread 6 seems to indicate something that is not in the main thread.

Yes. You’re right, The crash is probably after, since the if-block is not executed, but if i put the breakpoint after the if-block I never get to this point.
As I said before in another message, I’m sure the problem is about threads. The code is quite old and I don’t remember very well how threads were dealt, but as it worked in Windows I didn’t pay much attention in Mac. Besides, in Mac works with almost all examples. This one (causing the problem) is very big and probably something happens within the thread, while with the other examples there is no time to produce the problem.
Anyway, thank you very much for your time.

And if you try with the breakpoint where it is now (line 53) and use “Step into”?

As Michel said, getting a boolean value can’t crash your app per se. So either it’s a computed property (which “Step into” would show) or it’s something way unexpected (like the IDE crashing your app when the breakpoint brings the IDE to the front, etc.…).

As far as I can see moCalculs.CarreguesInicials is the last method called before OpenGL stuff comes in play. So, if moCalculs.CarreguesInicials is your code, start with a breakpoint somewhere here.

Thank you Carsten.
You were right. The problem was in my method “moCalculs.CarreguesInicials”. As it was in a Thread I could not see where it stopped. The problem was OpenGL, but very simple. I had forgotten to put the line
myOpenGLSirface.MakeCurrent
which is now necessary.
I understand that for Apple errors in OpenGL are not supported, but crashing without any comment is not good and for Xojo is not acceptable.

2 Likes