Re: My try/catch block isn't catching exceptions on 10.6

2009-11-30 Thread Kai Brüning
On 28.11.2009, at 13:57, Gwynne Raskind wrote: > On Nov 28, 2009, at 4:25 AM, Greg Parker wrote: >> Here's a fun idiom for handling both C++ and Objective-C exceptions in the >> same place (on iPhone and 64-bit Mac). >> >> @try { >> // do stuff >> } @catch (NSException *e) { >>

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Michael Ash
On Fri, Nov 27, 2009 at 2:40 PM, Mark Allan wrote: > > On 27 Nov 2009, at 1:10 am, Dave Keck wrote: >>> >>> Exception Type:  EXC_BAD_ACCESS (SIGBUS) >> >> After a cursory reading of your code it looks like you're dealing with >> a threading issue involving myItemList or imminentList. Your comment

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Gwynne Raskind
On Nov 28, 2009, at 4:25 AM, Greg Parker wrote: > Here's a fun idiom for handling both C++ and Objective-C exceptions in the > same place (on iPhone and 64-bit Mac). > >@try { >// do stuff >} @catch (NSException *e) { >// NSException >} @catch (id e) { >// Othe

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Greg Parker
On Nov 27, 2009, at 1:14 AM, Matt Gough wrote: The equivalent in Obj-c would be : @try { ... } @catch( NSException* e) { // deal with NSException } @catch(id ue) { // deal with any other sort of exception } There's also `...@catch (...)` in Objective-C. On iPhone and 64-bit Mac, `...@catch (.

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Scott Ribe
If one thread reads imminentList while another is modifying it, you can crash. There are instants during the modification where it will be in an internally inconsistent state. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice _

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Andrew Farmer
On 27 Nov 2009, at 11:40, Mark Allan wrote: > Isn't it the case that you only need locks around something if you plan that > it will be modified by more than one thread at a time, or if you write to it > in another thread and care that any read operation will be predictable? No, that is not the

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Mark Allan
On 27 Nov 2009, at 1:10 am, Dave Keck wrote: Exception Type: EXC_BAD_ACCESS (SIGBUS) After a cursory reading of your code it looks like you're dealing with a threading issue involving myItemList or imminentList. Your comment mentions "We don't really care if imminentList changes because the d

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Jeremy Pereira
On 26 Nov 2009, at 23:51, Mark Allan wrote: > > > Exception Type: EXC_BAD_ACCESS (SIGBUS) > Exception Codes: KERN_PROTECTION_FAILURE at 0x0010 > Crashed Thread: 3 You can't catch that with an Objective C exception handler. It's a Unix bus error. Probably some pointer has chang

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Matt Gough
On 27 Nov 2009, at 01:08:28, Graham Cox wrote: > Does Objective C support multiple catch blocks, like C++? In other words you > could do: > > @try > { > ... > } > @catch( NSException* e) > { > // deal with NSException > } > @catch(...) > { > // deal with any other sort of exception > } The e

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Dave Keck
> PS. Yes, I know there are faster and more efficient ways to enumerate an > array, but the old-school 'for' loop approach still comes to mind first and > I still prefer it for small arrays. Overlooking the speed benefits, fast enumeration will also throw an exception if the array you're enumerati

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Graham Cox
On 27/11/2009, at 10:51 AM, Mark Allan wrote: > @catch (NSException *e) { > NSLog(@"Splat! Reason: %@", [e reason]); Maybe the exception isn't an NSException*, and therefore uncaught by this. Does Objective C support multiple catch blocks, like C++? In other words you coul

My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Mark Allan
Hi folks, I've got a section of code which crashes intermittently under 10.6 but despite being enclosed in try/catch blocks, my app is still forced to terminate. For what it's worth, all of the crash reports are from 10.6.x. My app seems to be rock solid when run under 10.4 and 10.5. I