It is currently Mon Dec 11, 2017 5:12 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: My app crashes under High Sierra in WaitWindowEvent()
PostPosted: Mon Dec 04, 2017 3:13 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1079
Location: germany
Hi,

I still have to compile my app with PB 5.24 LTS, because in all later versions some bugs prevent me from using this compiler. No problem so far, but now people complain that my app is crashing on High Sierra.

I tried to reproduce and yes, after a while i get a crash. Using lldb showing this:

2017-12-04 14:58:51.521659+0100 myApp[1411:20855] Month 13 is out of bounds
myApp(1411,0xa9a801c0) malloc: *** error for object 0x6cb0b0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 1411 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0xa7642ef6 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0xa7642ef6 <+10>: jae 0xa7642f06 ; <+26>
0xa7642ef8 <+12>: calll 0xa7642efd ; <+17>
0xa7642efd <+17>: popl %edx
0xa7642efe <+18>: movl 0x242f12b(%edx), %edx
Target 0: (myApp) stopped.

After bt I get this stack:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0xa7642ef6 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0xa77734d7 libsystem_pthread.dylib`pthread_kill + 363
frame #2: 0xa7592b2a libsystem_c.dylib`abort + 133
frame #3: 0xa769ceed libsystem_malloc.dylib`free + 513
frame #4: 0xa6a3f59e libobjc.A.dylib`_object_dispose(objc_object*) + 28
frame #5: 0x9134d657 AppKit`-[NSResponder dealloc] + 137
frame #6: 0x9134c2bc AppKit`-[NSView dealloc] + 162
frame #7: 0x91447f3a AppKit`-[NSControl dealloc] + 143
frame #8: 0x91625512 AppKit`-[NSTableView dealloc] + 932
frame #9: 0x001780f9 myApp`-[PB_NSTableView dealloc] + 89
frame #10: 0xa6a3a9f9 libobjc.A.dylib`objc_object::sidetable_release(bool) + 269
frame #11: 0xa6a382d0 libobjc.A.dylib`-[NSObject release] + 19
frame #12: 0xa6a378fc libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 698
frame #13: 0x938c2b98 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #14: 0x952d5cc1 Foundation`-[NSAutoreleasePool release] + 120
frame #15: 0x001634c5 myApp`PB_Cocoa_FlushAutoreleasePool + 37
frame #16: 0x00164d31 myApp`PB_WaitWindowEvent2 + 129
frame #17: 0x00065a46 myApp`Repeat7383 + 10
Looks like it crashes in some function PB_WaitWindowEvent2 by freeing a pointer that is not allocated (any more?).

What can I do to make it run again? Interestingly, it does not crash in the IDE of PB 5.24 LTS on the same Mac. Only the compiled executable, compiled on El Capitan, seems affected :-( It worked fine on all previous Updates, but with 10.13 it starts to crash.

Any idea?


Last edited by Kukulkan on Mon Dec 04, 2017 5:06 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: My app crashes under High Sierra
PostPosted: Mon Dec 04, 2017 5:05 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1079
Location: germany
After a long debug session I can say it crashes in WaitWindowEvent() function:

Code:
...
Repeat
      GlobalLog(#RF_LOG_VERB, "A")
      ev = WaitWindowEvent(1) ; <--- CRASH HERE
      If ev <> 0
        GlobalLog(#RF_LOG_VERB, "B")
        handleWindowEvent(ev)
      EndIf
...

Last debug output I get is "A". My GlobalLog() function logs to a file.

Is this a known issue?

If compiled with PB 5.24 LTS on El Capitan, it crashes. If compiled with PB 5.24 LTS on High Sierra, it seem to work. Any idea about, how this can be?


Top
 Profile  
Reply with quote  
 Post subject: Re: My app crashes under High Sierra in WaitWindowEvent()
PostPosted: Mon Dec 04, 2017 5:18 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1039
Location: Germany
Mac with TouchBar?

Terminal:
defaults write -app "/Applications/YourAPP.app" NSFunctionBarAPIEnabled -bool NO

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: My app crashes under High Sierra in WaitWindowEvent()
PostPosted: Mon Dec 04, 2017 5:47 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1079
Location: germany
Quote:
Mac with TouchBar?
Terminal:
defaults write -app "/Applications/YourAPP.app" NSFunctionBarAPIEnabled -bool NO

Sadly, it does not help. The value is set to 0, but no change (I tested using defaults read -app "/Applications/YourAPP.app").

Hm. Due to some forum search I think it was a PB bug that was somehow fixed by Fred in newer versions.

viewtopic.php?t=68404
viewtopic.php?t=66610

But I can't switch to a new PB compiler that fast. I run automatic builds, having a few hundred customers and a new PB compiler potentially having new bugs -> causing a new and long QA cycle for me.

Is it known, what function or usage the segfault caused? Maybe I can avoid that?


Top
 Profile  
Reply with quote  
 Post subject: Re: My app crashes under High Sierra in WaitWindowEvent()
PostPosted: Tue Dec 05, 2017 7:28 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3006
Location: Netherlands
Kukulkan wrote:
Is it known, what function or usage the segfault caused? Maybe I can avoid that?

It's hard to tell. Crashes during WaitWindowEvent have happened before. They can be caused by an object that was marked for autorelease and also manually released.

Are you using any date functions ?
I noticed the "Month 13 is out of bounds" like there's an array of 12 months and you are trying to access a 13th one.

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: My app crashes under High Sierra in WaitWindowEvent()
PostPosted: Tue Dec 05, 2017 8:15 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1079
Location: germany
Hi,

Quote:
It's hard to tell. Crashes during WaitWindowEvent have happened before. They can be caused by an object that was marked for autorelease and also manually released.

Okay, but how can I solve it? The program is really big and the same code worked fine since MacOS 10.7 to 10.12. Now, on 10.13 I get this annoying error. Not sure how to fix it :(

It looks like it works if it is compiled on Mac 10.13 (same compiler!). But that means that something from MacOS El Capitan is contained in my executable that crashes on High Sierra. But if I compile on High Sierra, I first have to check if it still works on El Capitan...

Quote:
Are you using any date functions ?
I noticed the "Month 13 is out of bounds" like there's an array of 12 months and you are trying to access a 13th one.

It is a Mac bug: https://robservatory.com/month-13-is-out-of-bounds/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye