Re: NSWindowController and nib in framework

2012-09-26 Thread Quincey Morris
On Sep 26, 2012, at 18:10 , Jeff Johnson  
wrote:

> Is your app distributed as a zip file?
> 
> I had a similar bizarre issue with NSBundle a number of months ago, and it 
> turned out that the problem occurred when the app was unzipped using The 
> Unarchiver. Unzipping with the built-in Archive Utility fixed the problem. So 
> you might ask your customers about that.

It is distributed as a zip file.

If that's what's going on, it'd be another case of "really weird and 
unfortunate", as Kyle put it.

I'll see if I can find out how the unzipping was done.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-26 Thread Jeff Johnson
On Sep 26, 2012, at 12:51 PM, Quincey Morris wrote:

> On Sep 26, 2012, at 10:08 , Kyle Sluder  wrote:
> 
>> Can you log +[NSBundle allBundles] and/or use Instruments to see what file 
>> access Foundation is performing and what responses it's getting back?
> 
> The difficulty is that this exception has never happened to me during 
> development. By chance (maybe), it happened for 2 customers yesterday -- 
> though it had been fine earlier in the day for one of them -- and when I sent 
> them debug versions with NSBundle logging code the problem disappeared. Of 
> course that made them happy ("fixed!"), but it didn't really get me anywhere.
> 
> I'm wondering, somewhat randomly, whether this is not something asynchronous, 
> but perhaps something subtler like a missing write barrier. For example, if a 
> separate process is involved in either loading the framework or loading the 
> nib, and there's a missing write barrier for a value being returned to the 
> app process, so that the processor caches were inconsistent, then it would 
> only fail if the separate process happened to run in a different core and 
> would only fail for a short while till the caches were consistent again. But 
> this is beyond my competence, so it's probably just a fantasy.

Is your app distributed as a zip file?

I had a similar bizarre issue with NSBundle a number of months ago, and it 
turned out that the problem occurred when the app was unzipped using The 
Unarchiver. Unzipping with the built-in Archive Utility fixed the problem. So 
you might ask your customers about that.

-Jeff


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-26 Thread Mike Abdullah

On 26 Sep 2012, at 17:37, Quincey Morris  
wrote:

> On Sep 25, 2012, at 22:37 , Graham Cox  wrote:
> 
>> Is the app sandboxed?
>> 
>> I ask because I've had reports of this same error from the odd user but have 
>> been unable to reproduce it so far. It's ONLY happening since we sandboxed 
>> though.
> 
> No, the app has been around for a while and isn't sandboxed or code signed. 
> It's possible, though, that the error only started happening after sandboxing 
> was introduced, perhaps reflecting an implementation change in Cocoa 
> frameworks.
> 
> There's another similar error that occurred some months ago where a view 
> controller init in the same private framework failed:
> 
>   self = [super initWithNibName: @"MyNib" bundle: [NSBundle 
> bundleForClass: [self class]]];

It's worth noting that [self class] is a little bit dangerous here. If the 
instance happens to be a subclass of your class, you'll get back a different 
class and so search in the wrong bundle. Despite it feeling less clean, better 
to do:

self = [super initWithNibName:@"MyNib" bundle:[NSBundle bundleForClass: 
[MyClass class]]];
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-26 Thread Quincey Morris
On Sep 26, 2012, at 10:08 , Kyle Sluder  wrote:

> Can you log +[NSBundle allBundles] and/or use Instruments to see what file 
> access Foundation is performing and what responses it's getting back?

The difficulty is that this exception has never happened to me during 
development. By chance (maybe), it happened for 2 customers yesterday -- though 
it had been fine earlier in the day for one of them -- and when I sent them 
debug versions with NSBundle logging code the problem disappeared. Of course 
that made them happy ("fixed!"), but it didn't really get me anywhere.

I'm wondering, somewhat randomly, whether this is not something asynchronous, 
but perhaps something subtler like a missing write barrier. For example, if a 
separate process is involved in either loading the framework or loading the 
nib, and there's a missing write barrier for a value being returned to the app 
process, so that the processor caches were inconsistent, then it would only 
fail if the separate process happened to run in a different core and would only 
fail for a short while till the caches were consistent again. But this is 
beyond my competence, so it's probably just a fantasy.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-26 Thread Kyle Sluder
On Sep 26, 2012, at 9:37 AM, Quincey Morris 
 wrote:

> 
> It's as if there's a short asynchronous step in finding bundles, which leaves 
> a small timing window for failure that depends on the code order. I dunno.

That would be really weird and unfortunate. Can you log +[NSBundle allBundles] 
and/or use Instruments to see what file access Foundation is performing and 
what responses it's getting back?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-26 Thread Quincey Morris
On Sep 25, 2012, at 22:37 , Graham Cox  wrote:

> Is the app sandboxed?
> 
> I ask because I've had reports of this same error from the odd user but have 
> been unable to reproduce it so far. It's ONLY happening since we sandboxed 
> though.

No, the app has been around for a while and isn't sandboxed or code signed. 
It's possible, though, that the error only started happening after sandboxing 
was introduced, perhaps reflecting an implementation change in Cocoa frameworks.

There's another similar error that occurred some months ago where a view 
controller init in the same private framework failed:

self = [super initWithNibName: @"MyNib" bundle: [NSBundle 
bundleForClass: [self class]]];

I don't remember the exact exception message, but it basically said that the 
"MyNib" resource couldn't be found. In that case, changing the code to:

self = [super initWithNibName: @"MyNib" bundle: [NSBundle 
bundleWithIdentifier: frameworkBundleIdentifier]];

seemed to fix (or mask) the problem. However, finding the bundle that way 
*didn't* fix the window-nib-loading problem this time (the bundle was nil).

It's as if there's a short asynchronous step in finding bundles, which leaves a 
small timing window for failure that depends on the code order. I dunno.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWindowController and nib in framework

2012-09-25 Thread Graham Cox

On 26/09/2012, at 12:35 PM, Quincey Morris 
 wrote:

> Anyone have an idea what's going on here, and what I should really do to 
> avoid/fix the problem?


Is the app sandboxed?

I ask because I've had reports of this same error from the odd user but have 
been unable to reproduce it so far. It's ONLY happening since we sandboxed 
though.

--Graham
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com