iPad crash when backgrounding the app with SDK 2.9.3


Trying to upgrade my app to use iOS SDK 2.9.3. But I have found the app crashes when I background the app by pressing the home button. This occurs on the iPad but does not occur on the iPhone. This crash occurs on the iPad simulator as well.

The following is output to the console:
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Couldn’t initialise glObject. This is likely a problem with the GL context.

And here is the crash log:

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0

Application Specific Information:
abort() called

Filtered syslog:
None found

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000180b83014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000180c4b450 pthread_kill + 112
2 libsystem_c.dylib 0x0000000180af749c __abort + 144
3 libsystem_c.dylib 0x0000000180af740c __abort + 0
4 libc++abi.dylib 0x00000001805c12d4 __cxa_bad_cast + 0
5 libc++abi.dylib 0x00000001805deca8 default_terminate_handler() + 280
6 libobjc.A.dylib 0x00000001805ec860 _objc_terminate() + 152
7 TPNativeiPhone 0x0000000100648db8 CLSTerminateHandler() + 332
8 libc++abi.dylib 0x00000001805db66c std::__terminate(void (*)()) + 16
9 libc++abi.dylib 0x00000001805db234 __cxa_rethrow + 144
10 libobjc.A.dylib 0x00000001805ec71c objc_exception_rethrow + 44
11 CoreFoundation 0x0000000181a8e32c CFRunLoopRunSpecific + 560
12 GraphicsServices 0x0000000183542198 GSEventRunModal + 180
13 UIKit 0x0000000187ace7fc -[UIApplication _run] + 684
14 UIKit 0x0000000187ac9534 UIApplicationMain + 208
15 TPNativeiPhone 0x00000001000f0ba0 main (main.m:15)
16 libdyld.dylib 0x0000000180a715b8 start + 4


Hi cbartel,

Thanks for getting in touch!

We aren’t aware of the bug you’re describing.

However, we do have a counter measure for crashes in the GL when entering the background thread.

In your application can you call the ShinobiChart method setIsEnteringBackground: when entering & exiting the background thread?

More information on this property can be found in the Documentation folder of your Shinobi download.

If you are still seeing the issue, could you manipulate one of our sample apps to replicate the crash and send it to us at info@shinobicontrols.com?

As I’m struggling to reproduce your crash and it would really help us identify the source of this issue.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


Thanks for the quick response. In this case I have the shinobi chart inside a uitableviewcell. In some situations the uitableview is getting reloaded when the app is put in the background. The crash is occurring when the uitableview cell is dequeued.

I have put in a workaround to return an empty cell when the app is not active.

if UIApplication.shared.applicationState != .active {
return UITableViewCell()

Then I reload the uitableview when the app becomes active.

NotificationCenter.default.addObserver(self, selector: #selector(reloadData), name: NSNotification.Name.UIApplicationDidBecomeActive, object: .none)

This work around seems sufficient for my needs. Let me know if you have any other ideas.