Re: Bindings crash
Re: Bindings crash
- Subject: Re: Bindings crash
- From: Arved von Brasch <email@hidden>
- Date: Thu, 26 Jan 2012 10:12:52 +0000
Hi list,
This is the error I'm seeing:
2012-01-26 07:54:20.418 FileExplorer[1338:707] NSScanner: nil string
argument
2012-01-26 07:54:20.420 FileExplorer[1338:707] NSScanner: nil string
argument
2012-01-26 07:54:20.421 FileExplorer[1338:707] NSScanner: nil string
argument
2012-01-26 07:54:20.467 FileExplorer[1338:707] NSDecimalNumber overflow
exception
2012-01-26 07:54:20.692 FileExplorer[1338:707] (
0 CoreFoundation 0x00007fff92c1f286
__exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff9366ad5e
objc_exception_throw + 43
2 CoreFoundation 0x00007fff92c1f0ba
+[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff92c1f044
+[NSException raise:format:] + 116
4 Foundation 0x00007fff8d4be9fd
-[NSDecimalNumberHandler
exceptionDuringOperation:error:leftOperand:rightOperand:] + 193
<rest of stack dump snipped>
The first NSScanner error appears to be from the code I posted before.
The second two and the NSDecimalNumber overflow problem appear to be
from this:
- (NSString *)usedSpace {
NSDictionary *systemInfo = [[NSFileManager defaultManager]
attributesOfFileSystemForPath: [[NSBundle mainBundle] bundlePath] error:
nil];
NSDecimalNumber *total = [NSDecimalNumber decimalNumberWithString:
[[systemInfo objectForKey: NSFileSystemSize] stringValue]];
NSDecimalNumber *avail = [NSDecimalNumber decimalNumberWithString:
[[systemInfo objectForKey: NSFileSystemFreeSize] stringValue]];
return [self humanReadableNumber: [total decimalNumberBySubtracting:
avail]];
}
This problem seems to depend on the compilation order. Commenting out
the offending code, recompiling, then restoring the code and recompiling
makes the problem go away. Performing a Clean operation than
recompiling makes the problem reappear. This suggests compilation order
affects whether the systemInfo dictionary has valid elements or not at
runtime.
I could put in exception handling code for the NSDecimalNumber
operation, but as far as I can tell from the documentation, the
attributes in the dictionary shouldn't ever be empty. Any ideas on what
conditions I need to wait for? If something else must happen first,
then that would mean that this code can't be executed in response to a
binding, and I'd have to set their values directly.
As to why @dynamic is there, I thought that was the proper way to
implement a property where the implementation was supplied by me rather
than synthesised. Is that not the case?
Cheers,
Arved
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden