[SOLVED] Program aborted. (by external library)
Posted: Thu Feb 20, 2025 2:46 pm
I'm getting a crash on my Mac M2 Sequoia 15.2/PB 6.20 which I'm not sure how to debug further as the error message is not very informative. Program will run under the debugger for hours then aborts with this message:
My code has a threaded network procedure (not shown here) where binary data is sent and received over TCP. A structure guarded by a mutex is used to move information between thread and main UI loop, and in the network thread PostEvents are used for signalling when the UI needs updating. So every time the network thread sends data, which is every 5 seconds, it will emit a PostEvent(#EventUpdateTXLed)
This is then handled in the main loop:
The LEDCtrl() proc will in turn call StatusBar() listed below, which is where the crash supposedly happens on the last line (StatusBarImage()):
I'm fairly certain that I don't have a thread race condition anywhere and have no idea what this "external library" that is causing the crash is?
I've encountered the problem a few times now and while it may be coincidental, the crash appears to happen either while the screen is sleeping (WiFi is always powered on so network is always available) or shortly after the screen wakes up. Enabling Purifier will cause a hang without any error messages shown. Any suggestions on how to deal with my problem would be appreciated.
Code: Select all
[10:27:04] Executable type: MacOSX - arm64 (64bit, Unicode, Thread)
[10:27:04] Executable started.
[16:24:08] [ERROR] LSV6-Config.pb (Line: 851)
[16:24:08] [ERROR] Program aborted. (by external library)
This is then handled in the main loop:
Code: Select all
...
Case #EventUpdateTXLed ; TX Led is in the status bar and updated less frequently than top window
TXLEDState = #LED_On ; Only set state and leave UI updating to periodic call below
TXLEDTmr = ElapsedMilliseconds()
...
;Update status bar LEDs and indicators every 96 ms.
If elapsedMS - led_tmstamp > 96
LockMutex(TransferDataMtx)
LEDCtrl(@DeviceMsg)
UnlockMutex(TransferDataMtx)
led_tmstamp = elapsedMS
EndIf
Code: Select all
Procedure StatusBar(fieldIdx.i, icon.i, str.s, pad_top.i=0, pad_right=0)
If CreateImage(#MemCanvas, 150, 20)
If StartDrawing(ImageOutput(#MemCanvas))
Box(0, 0, 200, 20, SbarBGColor)
If fieldIdx <> #SBField_Padding
DrawingFont(FontID(sbFontID))
DrawingMode(#PB_2DDrawing_Transparent)
DrawAlphaImage(ImageID(icon), 0, 3+pad_top)
FrontColor(SbarFGColor)
DrawText(14+pad_right,1,str)
EndIf
StopDrawing()
EndIf
EndIf
StatusBarImage(0, fieldIdx, ImageID(#MemCanvas)) ; <*** Program aborted. (by external library)
EndProcedure
I've encountered the problem a few times now and while it may be coincidental, the crash appears to happen either while the screen is sleeping (WiFi is always powered on so network is always available) or shortly after the screen wakes up. Enabling Purifier will cause a hang without any error messages shown. Any suggestions on how to deal with my problem would be appreciated.