Re: Sending messages without knowing number of args and types at compile time

2010-02-02 Thread Per Bull Holmen
Greg Parker wrote:
> On Feb 1, 2010, at 3:30 AM, Per Bull Holmen wrote:
> > I've been playing around with the idea of making a simple bridge
> > between Objective-C (running under Cocoa) and a script language. 

/.../

> > I'd like to know whether there are any other ways than
> > NSInvocation to send a message without knowing arg types and numbers
> > at compile time. Non-hackish ways, that is. 
 
> NSInvocation is the most architecture-neutral way to go.
> 
> The best option outside NSInvocation is to use libffi to build calls
> to objc_msgSend. 

Thanks. I forgot to mention one thing: It need not be perfect! Far from it... 
:) Just a simple tool, to facilitate letting a script (Lua) control a Cocoa 
application. Therefore, I just might go for making a few quick implementations 
for common argument- and return type combinations, and use NSInvocation for 
everything else. Then the user can install their own quick handlers for 
combinations that aren't covered yet.

But libffi seems like a very interesting option. Michael Ash mentions PyObjC 
and RubyCocoa, a quick check reveals that they both use libffi. Any further 
questions regarding this will be sendt on the objc mailing list. Thanks!

Per
___

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

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


RegisterEventHotKey and keylogging

2010-02-02 Thread Michael Vannorsdel
Can RegisterEventHotKey be used to log an admin password or other  
passwords?  I accidentally hotkey'd some regular characters and had  
them trigger when typing in my admin pass on 10.5.8.

___

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

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


Breaking on 'autoreleased with no pool in place - just leaking'

2010-02-02 Thread Matt Gough
What symbol should I put a break point on to track down which part of my code 
is responsible for trying to autorelease without a pool in place.

i.e, what prints out the "__NSAutoreleaseNoPool(): Object 0xc74bc0 of class 
NSCFString autoreleased with no pool in place - just leaking" messages.

I tried NSLog and printf but it wasn't them.

Thanks

Matt Gough___

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

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


Re: Breaking on 'autoreleased with no pool in place - just leaking'

2010-02-02 Thread Dave Keck
> What symbol should I put a break point on to track down which part of my code 
> is responsible for trying to autorelease without a pool in place.
>
> i.e, what prints out the "__NSAutoreleaseNoPool(): Object 0xc74bc0 of class 
> NSCFString autoreleased with no pool in place - just leaking" messages.

_NSAutoreleaseNoPool()

=)
___

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

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


Re: RegisterEventHotKey and keylogging

2010-02-02 Thread Symadept
Hi Michael,

Basically RegisterEventHotKey registers given combination of hotkey
identified with the keycode. If it happens to be your pressing key is
registered as hotkey then you wont be able to see that. Lets say you have
registered A as hotkey in some application then either in your password or
username field you can never be able to print A and inturn fires hotkey
which may be the response of that particular app.

Hope it is clear to you.

Regards
Mustafa Shaik


On Tue, Feb 2, 2010 at 4:39 PM, Michael Vannorsdel wrote:

> Can RegisterEventHotKey be used to log an admin password or other
> passwords?  I accidentally hotkey'd some regular characters and had them
> trigger when typing in my admin pass on 10.5.8.
> ___
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/symadept%40gmail.com
>
> This email sent to symad...@gmail.com
>
___

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

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


Re: [MEET] February CocoaHeads Developer Meetings

2010-02-02 Thread Symadept
Why can't it be possible in Singapore?

-Mustafa


On Fri, Jan 29, 2010 at 11:20 AM, Stephen Zyszkiewicz
wrote:

> Greetings,
>
> CocoaHeads is an international Cocoa programmer's group. Meetings are free
> and open to the public. We specialize in Cocoa, but everything Mac/iPhone
> programming related is welcome.
>
> Upcoming meetings:
> Australia
> Sydney- Thursday, February 4, 2010 18:30.
>
> Austria
> Wien- Thursday, February 11, 2010 19:00.
>
> Germany
> Frankfurt- Monday, February 1, 2010 19:30.
> Munich- Wednesday, February 10, 2010 19:00.
>
> Sweden
> Stockholm- Monday, February 1, 2010 19:00.
>
> Switzerland
> Zürich- Wednesday, February 10, 2010 19:00.
>
> United States
> Ann Arbor- Thursday, February 11, 2010 19:00.
> Birmingham- Thursday, February 11, 2010 19:00.
> Boulder- Tuesday, February 9, 2010 19:00.
> Colorado Springs- Thursday, February 11, 2010 19:00.
> Columbus- Tuesday, February 9, 2010 19:00.
> Denver- Tuesday, February 9, 2010 19:00.
> Des Moines- Thursday, February 11, 2010 19:00.
> Philadelphia- Thursday, February 11, 2010 19:00.
> Sacramento- Tuesday, February 2, 2010 17:00.
>
>
> Some chapters may have yet to post their meeting for next month. Meeting
> times may change. Locations and more information here:
> http://cocoaheads.org
>
> Also be sure to check for an NSCoder Night in your area:
> http://nscodernight.com/
>
>
> Steve
> Silicon Valley CocoaHeads___
>
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/symadept%40gmail.com
>
> This email sent to symad...@gmail.com
>
___

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

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


Finder-like icon view (MIT license)

2010-02-02 Thread Alastair Houghton
Hi all,

I thought I'd just post a link to some code I just posted on Google Code.  It's 
been sitting on my disk for ages (since 2005, in fact), somewhat unloved and 
not quite complete, but I think it's still an interesting bit of code and 
hopefully someone will find it useful.

Here's the URL:

  

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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


Re: Finder-like icon view (MIT license)

2010-02-02 Thread Daniel DeCovnick

Shiny.

I really like the rectangle that appears when you hold shift so you  
know what will be selected next when you press an arrow key. Can you  
turn off snap-to-grid? Also, there is a serious spike in memory usage  
as the test app starts up. It releases most of that memory, but it's  
still disconcerting to watch multiple-hundred megabytes of RAM  
disappear for 10 seconds or so.


-Daniel

Daniel DeCovnick
danhd...@mac.com


On Feb 2, 2010, at 2:40 AM, Alastair Houghton wrote:


Hi all,

I thought I'd just post a link to some code I just posted on Google  
Code.  It's been sitting on my disk for ages (since 2005, in fact),  
somewhat unloved and not quite complete, but I think it's still an  
interesting bit of code and hopefully someone will find it useful.


Here's the URL:

 

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/danhd123%40mac.com

This email sent to danhd...@mac.com


___

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

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


Re: NSDocument "save as" bug

2010-02-02 Thread Mike Abdullah
-awakeFromNib is called whenever the receiver is awoken from a nib, or is used 
as the owner of a nib that is instantiated. Therefore, it may be called more 
than once on any given object.

What's happening:

Document system is preparing an accessory view for the save panel, probably so 
it can offer a popup with a few different document types. The view is loaded 
from a nib, by the document, and so calls -awakeFromNib.

Anyway, the fix:

Don't use -awakeFromNib. -windowControllerDidLoadNib: sounds like it's a better 
match for your needs.

Mike.

On 1 Feb 2010, at 07:13, Half Activist wrote:

> Hello,
>   In a NSDocument based application, my document class handles 3 
> different kinds of documents, 1 as a viewer and 2 as an editor.
>   Actually, I wished it could handle the 2 types as an editor but here is 
> what happens:
>   When I only have 1 type everything is ok as you might already have 
> understood, but when I add the second type and I go into "Save As..." the app 
> crashes under Snow Leopard.
>   It all boils down to the point that this little popup that's added to 
> the panel to select the file type seems to be screwing everything up.
> 
>   What's happening: my document class "awakeFromNib" gets called when the 
> save panel is loaded, I pasted the callstrack below:
> 
> #0  -[MyProjectDocument awakeFromNib] (self=0x100436c60, _cmd=0x7fff830614e0) 
> at /Users/devel/Work/Project/MyProjectDocument.m:371
> #1  0x7fff82927959 in -[NSIBObjectData 
> nibInstantiateWithOwner:topLevelObjects:] ()
> #2  0x7fff82925b49 in loadNib ()
> #3  0x7fff8292525c in +[NSBundle(NSNibLoading) 
> _loadNibFile:nameTable:withZone:ownerBundle:] ()
> #4  0x7fff82c93797 in -[NSDocument 
> _savePanelAccessoryViewForWritableTypes:defaultType:] ()
> #5  0x7fff82c91192 in -[NSDocument _preparedSavePanelForOperation:] ()
> #6  0x7fff82c9022b in -[NSDocument 
> _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] ()
> #7  0x7fff82c8dcda in -[NSDocument 
> runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:] ()
> #8  0x7fff82ab909a in -[NSApplication sendAction:to:from:] ()
> #9  0x7fff82add602 in -[NSMenuItem _corePerformAction] ()
> #10 0x7fff82add36c in -[NSCarbonMenuImpl 
> performActionWithHighlightingForItemAtIndex:] ()
> #11 0x7fff82d600b8 in -[NSMenu _internalPerformActionForItemAtIndex:] ()
> #12 0x7fff82c129d5 in -[NSCarbonMenuImpl 
> _carbonCommandProcessEvent:handlerCallRef:] ()
> #13 0x7fff82abfb60 in NSSLMMenuEventHandler ()
> #14 0x7fff83e48bd7 in DispatchEventToHandlers ()
> #15 0x7fff83e48126 in SendEventToEventTargetInternal ()
> #16 0x7fff83e65d49 in SendEventToEventTarget ()
> #17 0x7fff83e94d45 in SendHICommandEvent ()
> #18 0x7fff83ec1a1a in SendMenuCommandWithContextAndModifiers ()
> #19 0x7fff83ec19d4 in SendMenuItemSelectedEvent ()
> #20 0x7fff83ec18dc in FinishMenuSelection ()
> #21 0x7fff83ea2cf9 in MenuSelectCore ()
> #22 0x7fff83ea2461 in _HandleMenuSelection2 ()
> #23 0x7fff82990b79 in _NSHandleCarbonMenuEvent ()
> #24 0x7fff829646a2 in _DPSNextEvent ()
> #25 0x7fff82963b41 in -[NSApplication 
> nextEventMatchingMask:untilDate:inMode:dequeue:] ()
> #26 0x7fff82929747 in -[NSApplication run] ()
> #27 0x7fff82922468 in NSApplicationMain ()
> #28 0x0001172d in main (argc=1, argv=0x7fff5fbff7c0) at 
> /Users/devel/Work/Project/main.m:15
> 
>   Maybe should I report this bug to Apple?
>   Regards.___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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


Re: NSDocument "save as" bug

2010-02-02 Thread steven Hooley
> "It all boils down to the point that this little popup that's added to the 
> panel to select the file type seems to be screwing everything up."

Is the little popup loaded from a nib?
Is the 'File's Owner' of the little popup's nib set to your document?
Did you know that -awakeFromNib message is also sent to the File's
Owner object as well as the object archived in the nib?
___

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

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


Re: Finder-like icon view (MIT license)

2010-02-02 Thread Alastair Houghton
On 2 Feb 2010, at 10:51, Daniel DeCovnick wrote:

> I really like the rectangle that appears when you hold shift so you know what 
> will be selected next when you press an arrow key. Can you turn off 
> snap-to-grid?

Yes, you can turn that off; there isn't much documentation, but the methods in 
CSIconView.h should be obvious enough.

> Also, there is a serious spike in memory usage as the test app starts up. It 
> releases most of that memory, but it's still disconcerting to watch 
> multiple-hundred megabytes of RAM disappear for 10 seconds or so.

Not sure what that is; I'm sure there are plenty of bugs, since it isn't really 
being actively used anywhere, but then part of the point of posting the code is 
that other people can look at and hopefully use it.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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


tableView:objectValueForTableColumn: number column

2010-02-02 Thread Hado Hein
I have a table view which is feeded from an array.

- (id)tableView: (NSTableView *) aTableView objectValueForTableColumn:
(NSTableColumn *) aTableColumn row: (int) rowIndex
{
   CFStringRef returnvalue = 0;
   CFDictionaryRef fixture = [[deviceMenu selectedItem]
representedObject];
   CFMutableArrayRef patch = CFDictionaryGetValue(fixture,
CFSTR("Patch"));
   
   if ( CFEqual( [aTableColumn identifier], CFSTR("Parameter")) )
returnvalue = CFArrayGetValueAtIndex(patch, rowIndex);
//   else returnvalue = [NSString stringWithFormat:@"%d", rowIndex];
   else returnvalue = [[NSString stringWithFormat:@"%d", rowIndex]
autorelease];
   return returnvalue;
}

That works fine.
For convinience I wanted to provide the users with a numbering column in
the front.
The problem is that, at this point of code, I see no way to get the
actual value to release it.
The shown way with autorelease bails at the first attempt to scroll.


Is there a painless way to number rows?


-- 
Hado Hein (KSK, DTHG), master craftsman of stagecrafts, Berlin
followme office +49.30.91688488
www.beleuchtungsbildner.de - Stage Lighting Directing
www.batchmaker.de - Stage Lighting Design, Control and Routing
___

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

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


Re: tableView:objectValueForTableColumn: number column

2010-02-02 Thread Graham Cox

On 02/02/2010, at 11:39 PM, Hado Hein wrote:

> eturnvalue = [[NSString stringWithFormat:@"%d", rowIndex]
> autorelease];


> That works fine.

No it doesn't, because:

> For convinience I wanted to provide the users with a numbering column in
> the front.
> The problem is that, at this point of code, I see no way to get the
> actual value to release it.
> The shown way with autorelease bails at the first attempt to scroll.

That's because you've made a silly mistake. [NSString stringWithFormat] returns 
an already autoreleased object, or one you don't own, at any rate. So you 
should not autorelease it again. The object will be sent a -release message 
twice, and on the second one, will fail with EXC_BAD_ACCESS as the object has 
already been dealloced.

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

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


Threading issues with ivars

2010-02-02 Thread Andreas Grosam
Hello,

I have the following issue:

The code below shows a brief snippet of a view controller. Its responsibility - 
besides managing the views - is to create a URL request, and using a 
UIConnection to download data. Then, the data - a JSON format - will be parsed. 
The result is a dictionary from which I need certain fields which in turn shall 
be displayed in labels residing in the view controllers view.

The URL request will be done in a separate thread and yields data which is 
actually a JSON format (not shown in the code snipped). 

The parsing will be performed within yet another thread. Its main method is 
shown below.

The JSON parser returns an NSDictionary instance from which I need certain 
fields. These values will be used to set the text property of labels  which 
reside in the view controller.

There is a label "nameLabel" which text needs to be set from a certain field in 
the dictionary.  I don't want to set the label's text property directly in the 
main thread's method - instead I use an NSString instance called "name" to 
store the text. This is an ivar, see property declaration below.
Before the thread is finished and returns, it schedules the method 
-upadateLabels on the main thread which finally sets the label's text property  
(shown below).

Here is the issue:

Once the auto release pool gets released, the ivar "name" becomes invalid - as 
if it has been deallocated by the pool.

I don't see why this should happen, since I think I get a copy of the string - 
as the property declaration implies: @property (copy) NSString* name.

Do I miss something fundamentally?

I need to mention, this is code on the iPhone - no GC


Thanks in advance for pointing me to the solution.


Regards
Andreas


//  MainViewController.m
@interface MainViewController ()
@property (nonatomic, retain) IBOutlet UILabel* nameLabel;
@property (copy)   NSString*name;
@end

@implementation MainViewController

@synthesize name;
@synthesize nameLabel;


- (void)threadMain:(NSData *)data 
{
NSAutoreleasePool*  pool = [[NSAutoreleasePool alloc] init];
NSString*   jsonResponse = nil;
SBJsonParser*   parser = nil;

@try {
jsonResponse = [[NSString alloc] initWithData:data 
encoding:NSUTF8StringEncoding];
parser = [[SBJsonParser alloc] init];

id jsonObject = [parser objectWithString:jsonResponse];
NSDictionary* feature = [(NSArray*)[jsonObject 
objectForKey:@"features"] objectAtIndex:0];

self.name = [[feature objectForKey:@"properties"] objectForKey:@"name"];

if (jsonObject) {
[self performSelectorOnMainThread:@selector(updateLabels) 
withObject:nil waitUntilDone:NO];
}
}
@catch (NSException * ex) {

}
@finally {
[jsonResponse release]; 
[parser release];
[pool release];
}
}


- (void) updateLabels
{
self.nameLabel.text = self.name;
}



One *important* observations is here:
Before generating the URL request, I actually need a parameter which is asked 
from the user via an interface.
When the user starts to edit the input (a UITextField) the view controller gets 
notified through a method, shown below.
The purpose of this method is to clear the previous results.

** IFF I do not set the text property to nil, the NSString instance "name" 
remains valid. So, it seems, that the string object will be *shared* - but not 
copied. Hence the auto release pool does not dealloc the string. The label's 
text property is declared as: @property(nonatomic, copy) NSString* text
This looks strange to me. Any thoughts?


- (void)textFieldDidBeginEditing:(UITextField *)textField
{
// User entered editing: clear labels:
self.nameLabel = nil;  // if uncommented, the ivar "name" remains valid 
}

___

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

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


Re: Threading issues with ivars

2010-02-02 Thread Graham Cox

On 02/02/2010, at 11:49 PM, Andreas Grosam wrote:

> I don't see why this should happen, since I think I get a copy of the string 
> - as the property declaration implies: @property (copy) NSString* name.
> 
> Do I miss something fundamentally?


My understanding is that  refers to the read of the property, not the 
setting of it. In other words, when you ask for name, you get a copy, but when 
it's passed in it is not copied. And since you haven't marked it as being 
retained, it's just a weak ref.

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

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


Re: Threading issues with ivars

2010-02-02 Thread Graham Cox

On 02/02/2010, at 11:53 PM, Graham Cox wrote:

> My understanding is that  refers to the read

OK, scratch that - my understanding was wrong. I should have checked before 
posting - indeed, copy refers to the assignment, not the read.

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

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


Re: Threading issues with ivars

2010-02-02 Thread Peter Blazejewicz
Hi Andreas,
You're not clearing "text" - you're clearing UILabel reference in your code:

self.nameLabel = nil;

If you wan't to reset just text then: self.nameLabel.text = @"";
(or any way you prefer depending on UI requirements),

With your current code you just sending message to nameLabel = which
is actually nil in your -(void)updateLabels method,
regards,
Peter Blazejewicz

On Tue, Feb 2, 2010 at 1:49 PM, Andreas Grosam  wrote:
> Hello,
>
> I have the following issue:
>
>
> There is a label "nameLabel" which text needs to be set from a certain field 
> in the dictionary.  I don't want to set the label's text property directly in 
> the main thread's method - instead I use an NSString instance called "name" 
> to store the text. This is an ivar, see property declaration below.
> Before the thread is finished and returns, it schedules the method 
> -upadateLabels on the main thread which finally sets the label's text 
> property  (shown below).
>
>
>
>
> - (void) updateLabels
> {
>    self.nameLabel.text = self.name;
> }
>
>
>
> One *important* observations is here:
> Before generating the URL request, I actually need a parameter which is asked 
> from the user via an interface.
> When the user starts to edit the input (a UITextField) the view controller 
> gets notified through a method, shown below.
> The purpose of this method is to clear the previous results.
>
> ** IFF I do not set the text property to nil, the NSString instance "name" 
> remains valid. So, it seems, that the string object will be *shared* - but 
> not copied. Hence the auto release pool does not dealloc the string. The 
> label's text property is declared as: @property(nonatomic, copy) NSString* 
> text
> This looks strange to me. Any thoughts?
>
>
> - (void)textFieldDidBeginEditing:(UITextField *)textField
> {
>    // User entered editing: clear labels:
>    self.nameLabel = nil;  // if uncommented, the ivar "name" remains valid
> }
>
> ___
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/peter.blazejewicz%40gmail.com
>
> This email sent to peter.blazejew...@gmail.com
>
___

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

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


Re: Threading issues with ivars

2010-02-02 Thread Andreas Grosam


On Feb 2, 2010, at 2:16 PM, Peter Blazejewicz wrote:

> Hi Andreas,
> You're not clearing "text" - you're clearing UILabel reference in your code:
> 
> self.nameLabel = nil;

Doh!
Especially, as I have *three* labels, and only this one was wrong ...


Thank you very much Peter!  I almost lost faith in Objective-C - but no -- 
everything is OK. All speculations were wrong, no autorelease pool issue, no 
thread issue -- Objective-C works like a charm!   :)

Andreas

___

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

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


NSArrayController predicate filtering weirdness

2010-02-02 Thread Markus Spoettl
Hello,

  I have a problem with filtering an NSArrayController that I can't understand. 
Under some (unknown) circumstances, my array controller produces different 
filtered results, seemingly depending on which filter predicate was selected 
previously.

It goes something like this:

Filter using predicate A => arrangedObjects contains 4 objects  (correct)
Filter using predicate F => arrangedObjects contains 0 objects  (incorrect)
Filter using predicate B => arrangedObjects contains 2 objects  (correct)
Filter using predicate F => arrangedObjects contains 1 object   (correct)

Predicate F is identical in both cases (meaning it's the exact same object) 
also the content (unfiltered) of the array controller doesn't change between 
filter assignments. 

I have found that setting the controller's filter predicate to nil before 
applying the filter predicate I want fixes the issue. However, I have a strong 
suspicion that this just covers up a problem somewhere else.

What could be the cause of behavior like this? Any hints greatly appreciated!

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Re: Core Data - Add an Entity to another Entity How?

2010-02-02 Thread Jerry Krinock

On 2010 Feb 01, at 10:32, Andreas Grauel wrote:

> I have the autogenerated accessor Methods and also added the implementation 
> code
> "-(void) addPersonObject " but how can work with these Methods? I am not
> able to hook them up in Interface Builder.

Write an action method which invokes either -addPersonObject or -addGameObject, 
depending on which tab is selected in your detail view on the right.  Wire the 
button to this new action method.

___

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

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


Reading Modifier Keys Down during Launch - still needs "Carbon"?

2010-02-02 Thread Jerry Krinock
In Mac OS 10.6, during -applicationDidFinishLaunching, [NSEvent currentEvent] 
returns nil, so the usual code,

   [[NSEvent currentEvent] modifierFlags]

is not useful for determining if a modifier key was held down during launch.  
(By accident, I've noticed that I do get an event with correct modifierFlags if 
I send the message after a performSelector:withObject:afterDelay:.05.  But I'd 
rather not do that.)

Searching the list archives, from 8 years ago I find the solution is to instead 
#import  and use GetCurrentEventKeyModifiers().

It works, and although there is copious documentation in the header and in the 
Carbon Event Manager Programming Guide, searching current Xcode documentation 
for this function gives "No Results", and since this function returns a UInt32, 
I wonder if it will be supported in current and future 64-bit builds? 

Thanks,

Jerry Krinock___

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

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


Re: Reading Modifier Keys Down during Launch - still needs "Carbon"?

2010-02-02 Thread Jean-Daniel Dupas

Le 2 févr. 2010 à 15:51, Jerry Krinock a écrit :

> In Mac OS 10.6, during -applicationDidFinishLaunching, [NSEvent currentEvent] 
> returns nil, so the usual code,
> 
>   [[NSEvent currentEvent] modifierFlags]
> 
> is not useful for determining if a modifier key was held down during launch.  
> (By accident, I've noticed that I do get an event with correct modifierFlags 
> if I send the message after a performSelector:withObject:afterDelay:.05.  But 
> I'd rather not do that.)
> 
> Searching the list archives, from 8 years ago I find the solution is to 
> instead #import  and use GetCurrentEventKeyModifiers().
> 
> It works, and although there is copious documentation in the header and in 
> the Carbon Event Manager Programming Guide, searching current Xcode 
> documentation for this function gives "No Results", and since this function 
> returns a UInt32, I wonder if it will be supported in current and future 
> 64-bit builds? 


NSUInteger modifiers  = 
CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState);



-- Jean-Daniel




___

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

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


Re: Showing a menu after a delay...?

2010-02-02 Thread Eric Gorr
On Feb 1, 2010, at 6:18 PM, Nathan Kinsinger wrote:

> On Feb 1, 2010, at 2:42 PM, Eric Gorr wrote:
> 
>> What I am trying to accomplish is displaying a menu (perhaps with 
>> NSPopUpButtonCell's performClickWithFrame method) after a user clicks on a 
>> sublass of NSButton and holds the left mouse button for >= 1 second.
>> 
>> Is anyone aware of any sample code doing this?
> 
> Look at KBPopUpToolbarItem.m
> http://www.literatureandlatte.com/freestuff/index.html

While looking over this code, it prompted me to take a closer look at NSCell. I 
noticed in NSCell, that the documentation for 
trackMouse:inRect:ofView:untilMouseUp: says:

This method is generally not overridden because the default implementation 
invokes other NSCell methods that can be overridden to handle specific events 
in a dragging session.

Some of those other methods it is referring to are:

startTrackingAt:inView:
continueTracking:at:inView:
stopTracking:at:inView:mouseIsUp:

However, it does not appear the implementation of 
trackMouse:inRect:ofView:untilMouseUp: for a NSButtonCell calls 
continueTracking:at:inView: or stopTracking:at:inView:mouseIsUp: which I 
believe would have been useful in my situation. I would have liked to not need 
to have a complete rewrite of trackMouse:inRect:ofView:untilMouseUp:.

If it matters, I am building with the 10.5 SDK.

I have filed a bug requesting that trackMouse:inRect:ofView:untilMouseUp: call 
continueTracking:at:inView: and stopTracking:at:inView:mouseIsUp: ... or is 
there a reason why it shouldn't?

rdar://7602114


___

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

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


Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?

2010-02-02 Thread Jerry Krinock

On 2010 Feb 01, at 03:53, Quincey Morris wrote:

> I'd point you to the the documentation:

   (This is the quote from "Cocoa Bindings Programming Topics" the 
documentation I quoted in my original post.)

> I don't see how this can be clearer that bindings are bidirectional.

Yes.  It is clear.  And I had always thought that bindings were bidirectional, 
based on this documentation.  Then, two weeks ago, I noticed that -bind:::only 
implemented observer behavior in one direction.  I then read *this* 
documentation:

> bind:toObject:withKeyPath:options:
> 
> "Establishes a binding between a ..."

"Establishes a binding!"  So, then, having forgotten the other documentation, I 
thought like Matt, that bindings are unidirectional.  Until I tried it with an 
NSButton.

So now we have this paradox:

1.  "Cocoa Bindings Programming Topics" says that bindings are bidirectional.
2.  bind:toObject:withKeyPath:options: documentation says it "establishes a 
binding"
3.  bind:toObject:withKeyPath:options: implementation establishes something 
which
is unidirectional.

Choose one of the following explanations:

1.  "Cocoa Bindings Programming Topics" is wrong.
2.  bind:toObject:withKeyPath:options: documentation is wrong.
3.  The use of the word "binding" in "Cocoa Bindings Programming Topics" is
different than the usage in bind:toObject:withKeyPath:options:
documentation.  (This would bring the number of definitions Apple
has for the word "binding" up to about 5.  A whole 'nother topic.)
4.  The implementation of bind::: is incomplete.
5.  bind::: does what its documentation says, based on a very critical
legalistic reading, as I explained at the bottom of my second post.
Quincey has explained further that you must override it and to get the
additional "bindings behaviors" and get a complete binding.

Quincey, I believe that you would vote for explanation #5, but it appears that 
you have invented a term "bindings link" to refer to the unidirectional binding:

> implementation of 'bind:...' that correctly establishes bindings links for 
> behaviors implemented in the frameworks (NS) subclasses.


Could you possibly also support explanation #2?

___

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

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


Re: Sending messages without knowing number of args and types at compile time

2010-02-02 Thread Jens Alfke

On Feb 2, 2010, at 12:21 AM, Per Bull Holmen wrote:

> Thanks. I forgot to mention one thing: It need not be perfect! Far from it... 
> :) Just a simple tool, to facilitate letting a script (Lua) control a Cocoa 
> application.

FYI, there was already a Lua/Obj-C bridge library circa 2006, although I don't 
remember the name or have a URL handy. (Sorry.) There may also be newer ones by 
now, because there seem to be a couple of newish Lua libraries for writing 
iPhone games, and they probably involve some kind of bridging to Obj-C.

—Jens

(Fun fact: the RSS reader in Safari uses Lua as a template language to generate 
the HTML news-feed pages from the PubSub 
database.)___

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

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


Re: Sending messages without knowing number of args and types at compile time

2010-02-02 Thread Dave DeLong
http://luaforge.net/projects/luaobjc

On Feb 2, 2010, at 9:15 AM, Jens Alfke wrote:

> FYI, there was already a Lua/Obj-C bridge library circa 2006, although I 
> don't remember the name or have a URL handy. (Sorry.)


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Re: NSProgressIndicator Stuck after unhiding + other triggers. Demo App.

2010-02-02 Thread Jerry Krinock
Since no one offered an explanation for this, I filed a bug.  7602237.

The short workaround lesson is this:  Do not unhide an NSProgressIndicator and 
then re-use it in determinate mode.  Instead, create a new one in the same 
frame, as shown in the -recreate: method in my original post.

___

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

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


NSTableView questions (take 2)

2010-02-02 Thread Matthew Weinstein
Still trying to find a way to turn off setAllowsMultipleSelection just  
as the table becomes the responder. Is there some way of anticipating  
this, a "willbecomefirstresponder" kind of a notification?


Thanks in advance, Matthew Weinstein
___

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

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


Opening dual NSStreams synchronously

2010-02-02 Thread Richard Penwell
Hello Devs,

I'd like some feedback on my design here as I'm building an API that I hope 
will be of use to the community, and some of the finer nuances of Cocoa still 
escape me.

I'm building a class called TDSConnection which is part of a object graph 
providing connectivity to the Tabular Data Stream format in objective-c.  (TDS 
is the Microsoft SQL protocol).  What I've got is some interesting threading 
and synchronization issues.  The one that I'm trying to check for correctness 
currently is thus:

I have a method -[TDSConnection open] which should open two NSStreams (input 
and output), block until both are open or erred then perform the TDS packets 
for login.  The method of doing this for me looks like this:

- (void)open
{
[self close];

[NSStream getStreamsToHost:host 
  port:port 
   inputStream:&inputStream 
  outputStream:&outputStream];

[inputStream setDelegate:self];
[outputStream setDelegate:self];

[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] 
   
forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] 

forMode:NSDefaultRunLoopMode];

[inputStreamCondition lock];
[outputStreamCondition lock];
[inputStream open];
[outputStream open];

[inputStreamCondition wait];
[outputStreamCondition wait];
}

- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode
{
if (stream == inputStream) {
[self handleInputStreamEvent:eventCode];
} else if (stream == outputStream) {
[self handleOutputStreamEvent:eventCode];
} else {
NSLog(@"Recieved a stream event for instance %@ which was not 
the input or output stream", stream);
}
}

- (void)handleInputStreamEvent:(NSStreamEvent)eventCode {
switch (eventCode) {
case NSStreamEventOpenCompleted:
[inputStreamCondition signal];
break;
default:
break;
}
}

- (void)handleOutputStreamEvent:(NSStreamEvent)eventCode {
switch (eventCode) {
case NSStreamEventOpenCompleted:
[outputStreamCondition signal];
break;
default:
break;
}
}

As can be seen, I am using a NSCondition to block the main thread until I 
receive both NSStreamEventOpenCompleted events.

I have a feeling that this code smells a bit, and was wondering if someone 
who's done some networking programming has recommendations.


Grateful as always,
Richard
___

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

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


Re: Reading Modifier Keys Down during Launch - still needs "Carbon"?

2010-02-02 Thread Eric Schlegel

On Feb 2, 2010, at 6:51 AM, Jerry Krinock wrote:

> Searching the list archives, from 8 years ago I find the solution is to 
> instead #import  and use GetCurrentEventKeyModifiers().
> 
> It works, and although there is copious documentation in the header and in 
> the Carbon Event Manager Programming Guide, searching current Xcode 
> documentation for this function gives "No Results", and since this function 
> returns a UInt32, I wonder if it will be supported in current and future 
> 64-bit builds? 

Yes, it will be until we decide to break compatibility with 64-bit Cocoa 
applications, but in addition to the CG option already mentioned, in 10.6 
there's also a modifierFlags class method on NSEvent, so this works:

NSUInteger flags = [NSEvent modifierFlags];

-eric___

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

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


Re: NSTableView questions (take 2)

2010-02-02 Thread Corbin Dunn

On Feb 2, 2010, at 8:32 AM, Matthew Weinstein wrote:

> Still trying to find a way to turn off setAllowsMultipleSelection just as the 
> table becomes the responder. Is there some way of anticipating this, a 
> "willbecomefirstresponder" kind of a notification?

What are you really trying to do? Or, in other words, what is the goal with 
doing this?

--corbin

___

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

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


Re: Reading Modifier Keys Down during Launch - still needs "Carbon"?

2010-02-02 Thread Jerry Krinock

On 2010 Feb 02, at 07:02, Jean-Daniel Dupas wrote:

> NSUInteger modifiers  = 
> CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState);

Thank you, Jean-Daniel.  So we have in fact *three* API to get modifier keys.  
Looks like the one you gave is the best.  Since I had Bug Reporter open, I 
filed a bug asking Apple to clarify the situation and possibly depracate some.

___

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

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


Re: NSTableView questions (take 2)

2010-02-02 Thread Corbin Dunn
Table b should be set to setAllowsMultipleSelection:NO. However, despite that, 
you can programmatically change the selection yourself with 
-setSelectedRowIndexes:byExtendingSelection: when the selection in Table A 
changes.

--corbin

> I have 2 tables that basically have a many to many relationship. If I click 
> on table A I want multiple values of table B to be selected; but I click on 
> table B I want to make sure I can't select multiple values
> 
> On Feb 2, 2010, at 8:53 AM, Corbin Dunn wrote:
> 
>> 
>> On Feb 2, 2010, at 8:32 AM, Matthew Weinstein wrote:
>> 
>>> Still trying to find a way to turn off setAllowsMultipleSelection just as 
>>> the table becomes the responder. Is there some way of anticipating this, a 
>>> "willbecomefirstresponder" kind of a notification?
>> 
>> What are you really trying to do? Or, in other words, what is the goal with 
>> doing this?
>> 
>> --corbin
>> 
> 
___

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

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


Re: NSArrayController predicate filtering weirdness

2010-02-02 Thread Markus Spoettl
On Feb 2, 2010, at 3:16 PM, Markus Spoettl wrote:
> It goes something like this:
> 
> Filter using predicate A => arrangedObjects contains 4 objects  (correct)
> Filter using predicate F => arrangedObjects contains 0 objects  (incorrect)
> Filter using predicate B => arrangedObjects contains 2 objects  (correct)
> Filter using predicate F => arrangedObjects contains 1 object   (correct)
> 
> Predicate F is identical in both cases (meaning it's the exact same object) 
> also the content (unfiltered) of the array controller doesn't change between 
> filter assignments. 


Following up on this I also tried using -rearrangeObjects on the array 
controller after setting the filter predicate. This also fixes this problem.

Now the question for me is, when I set the filter predicate, am I supposed to 
have to call -rearrangeObjects manually? Up until now I don't do this and 
filtering works as expected (and has for a long time) in many different places 
of the application (except for the case reported in the original post) both on 
10.5 and 10.6.

Documentation doesn't tell me what to do. It doesn't say that 
-setFilterPredicate: causes automatic rearrangement,  but it obviously does 
something. It's not producing the correct result in this particular case, 
though.

Any advice? Just in case I paste the code that sets the filter predicate below.

Regards
Markus


- (void)activatePredicate:(NSPredicate *)predicate 
onController:(NSArrayController *)ctrlr
{
[ctrlr setFilterPredicate:predicate]; 
NSLog(@"arrangedObjects: %@", [ctrlr arrangedObjects]);  // reports 0 
objects
[ctrlr rearrangeObjects];
NSLog(@"arrangedObjects: %@", [ctrlr arrangedObjects]);  // reports 1 object
}

--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Re: NSTableView questions (take 2)

2010-02-02 Thread Corbin Dunn
Matthew -- I believe there was a problem with < 10.5 asserting; that has been 
fixed, but you have to link on 10.5+ to get the "fixed" behavior (for 
compatibility reasons). I suggest requiring your uses to upgrade :)

However, you should be able to do -setAllowsMultipleSelection:YES, select the 
rows, and then setAllowsMultipleSelection:NO

corbin

On Feb 2, 2010, at 9:18 AM, Matthew Weinstein wrote:

> So this is the rub: If I just set allowsMultipleSelection: NO in interface 
> builder and don't set allowsMultipleSelection:YES  [programmatically right 
> before doing the setSelected... (though I have to support 10.2-?? so I am 
> still using setSelectedRow...)] I get the following error:
> 
> 2010-02-02 09:02:06.039 TAMSAnalyzer[30180:10b] *** Assertion failure in 
> -[NSTableView selectRow:byExtendingSelection:], 
> /SourceCache/AppKit/AppKit-949.54/TableView.subproj/NSTableView.m:9223
> 2010-02-02 09:02:06.040 TAMSAnalyzer[30180:10b] Invalid parameter not 
> satisfying: !extend || _tvFlags.allowsMultipleSelection
> 2010-02-02 09:02:24.675 TAMSAnalyzer[30180:10b] *** Assertion failure in 
> -[NSTableView selectRow:byExtendingSelection:], 
> /SourceCache/AppKit/AppKit-949.54/TableView.subproj/NSTableView.m:9223
> 2010-02-02 09:02:24.675 TAMSAnalyzer[30180:10b] Invalid parameter not 
> satisfying: !extend || _tvFlags.allowsMultipleSelection
> 
> 
> If I do programatically allow multiple selection in table B right before I do 
> the setSelectedRow: byExtending...:YES; it seems to work fine. That is, until 
> I click in Table B, there it's allowing multiple selections and I don't want 
> it to.
> 
> THE PROBLEM is when to turn off the allowMultipleSelection. I need to capture 
> the mouse down when the user clicks in table B to forbid multiple selections 
> (back to its default state).
> 
> On Feb 2, 2010, at 9:08 AM, Corbin Dunn wrote:
> 
>> Table b should be set to setAllowsMultipleSelection:NO. However, despite 
>> that, you can programmatically change the selection yourself with 
>> -setSelectedRowIndexes:byExtendingSelection: when the selection in Table A 
>> changes.
>> 
>> --corbin
>> 
>>> I have 2 tables that basically have a many to many relationship. If I click 
>>> on table A I want multiple values of table B to be selected; but I click on 
>>> table B I want to make sure I can't select multiple values
>>> 
>>> On Feb 2, 2010, at 8:53 AM, Corbin Dunn wrote:
>>> 
 
 On Feb 2, 2010, at 8:32 AM, Matthew Weinstein wrote:
 
> Still trying to find a way to turn off setAllowsMultipleSelection just as 
> the table becomes the responder. Is there some way of anticipating this, 
> a "willbecomefirstresponder" kind of a notification?
 
 What are you really trying to do? Or, in other words, what is the goal 
 with doing this?
 
 --corbin
 
>>> 
> 

___

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

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


Re: NSTableView questions (take 2)

2010-02-02 Thread Matthew Weinstein

Thanks Corbin,

So this is the rub: If I just set allowsMultipleSelection: NO in  
interface builder and don't set allowsMultipleSelection:YES   
[programmatically right before doing the setSelected... (though I have  
to support 10.2-?? so I am still using setSelectedRow...)] I get the  
following error:


2010-02-02 09:02:06.039 TAMSAnalyzer[30180:10b] *** Assertion failure  
in -[NSTableView selectRow:byExtendingSelection:], /SourceCache/AppKit/ 
AppKit-949.54/TableView.subproj/NSTableView.m:9223
2010-02-02 09:02:06.040 TAMSAnalyzer[30180:10b] Invalid parameter not  
satisfying: !extend || _tvFlags.allowsMultipleSelection
2010-02-02 09:02:24.675 TAMSAnalyzer[30180:10b] *** Assertion failure  
in -[NSTableView selectRow:byExtendingSelection:], /SourceCache/AppKit/ 
AppKit-949.54/TableView.subproj/NSTableView.m:9223
2010-02-02 09:02:24.675 TAMSAnalyzer[30180:10b] Invalid parameter not  
satisfying: !extend || _tvFlags.allowsMultipleSelection



If I do programatically allow multiple selection in table B right  
before I do the setSelectedRow: byExtending...:YES; it seems to work  
fine. That is, until I click in Table B, there it's allowing multiple  
selections and I don't want it to.


THE PROBLEM is when to turn off the allowMultipleSelection. I need to  
capture the mouse down when the user clicks in table B to forbid  
multiple selections (back to its default state).


On Feb 2, 2010, at 9:08 AM, Corbin Dunn wrote:

Table b should be set to setAllowsMultipleSelection:NO. However,  
despite that, you can programmatically change the selection yourself  
with -setSelectedRowIndexes:byExtendingSelection: when the selection  
in Table A changes.


--corbin

I have 2 tables that basically have a many to many relationship. If  
I click on table A I want multiple values of table B to be  
selected; but I click on table B I want to make sure I can't select  
multiple values


On Feb 2, 2010, at 8:53 AM, Corbin Dunn wrote:



On Feb 2, 2010, at 8:32 AM, Matthew Weinstein wrote:

Still trying to find a way to turn off setAllowsMultipleSelection  
just as the table becomes the responder. Is there some way of  
anticipating this, a "willbecomefirstresponder" kind of a  
notification?


What are you really trying to do? Or, in other words, what is the  
goal with doing this?


--corbin





___

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

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


performFindPanelAction

2010-02-02 Thread John Nairn
I tried to implement performFindPanelAction: in my NSWindowController  
to do something for fields that do not support the find panel (e.g.  
NSTextField or WebView), but I can't get the menu command to activate.  
It is wired to firstResponder and according to documentation, the  
window's controller is in the responder chain, but it still does not  
get through?


Is it possible an NSTextField (or its associated shared editing  
object) is rejected the command and therefore blocking it from moving  
through the responder chain? If yes, it would be good to either have  
NSTextField handle find panel itself or make it pass the command along?


---
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://www.cof.orst.edu/cof/wse/faculty/Nairn/
FEA/MPM Web Page: http://oregonstate.edu/~nairnj




___

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

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


Arbitrary Attributes affect text layout

2010-02-02 Thread Philip White
Hello,
   I have a problem I can't quite figure out. I have a program that displays 
some Hebrew text. I notice that at times some of the vowel markings are not 
displayed in the correct place. I figured out that this happened when I had 
applied some arbitrary attributes to that range of text.
  I was under the impression that one could set any key value pair not used by 
the Cocoa text system to a part of an attributed string without consequence.

  Anyway, I wrote a test program that illustrates this quite dramatically. All 
the program does is this basically:

-(IBAction)work:(id)sender
{
NSTextStorage *ts = [textView textStorage];

NSRange r = {0,1};
for (;r.location+r.length<=[ts length]; r.location++)
{
[ts addAttribute:[NSString 
stringWithFormat:@"Nonsense%u",r.location]
   value:[NSString 
stringWithFormat:@"Gibberish%u",r.location]
   range:r];
}
}

The results can be seen in the two images on this webpage: 
http://www.rivulus-sw.com/junk/hebrew_text_test.html
The xcode project for the test program can be downloaded from 
http://www.rivulus-sw.com/junk/hebrew_text_tester.zip

Note that copying the garbled text into another program, like TextEdit, where 
the additional attributes are presumably stripped out, causes the test to 
display normally again.
With Latin text I haven't seen any problems, even when using diacriticals.

The problems in my actual program have been much more subtle than those in the 
test program, probably because I haven't been applying different attributes to 
each character.

Could someone give me some tips on what I'm doing wrong here or how I can avoid 
this text mangling?

Many Thanks,
   Philip White
___

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

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


HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Oleg Krupnov
Hi,

After publishing an update of my app, I have received quite a few
crash dumps with very weird stack traces that I cannot understand and
fix.

Namely, the exception message says that AXTitle, or AXWindow or
AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
NSApplication and others. Does it have something to do with
accessibility? In what way?

If someone knows what's that supposed to mean, a quick response would
be very much appreciated. This is an emergency for me.

Here's one of those logs (All those users are running Snow Leopard 10.6.2):

MESSAGE:
"AXTitle" attribute unsupported by: 

STACK TRACE:
#0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
(/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
#1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
#2  0x97a91a21 +[NSException raise]
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#3  0x91d9a55c NSAccessibilityAttributeValue()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#5  0x91fb49d7 CopyAttributeValue()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#6  0x9476bad3 _AXXMIGCopyAttributeValue()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#7  0x94775b96 _XCopyAttributeValue()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#8  0x94747c39 mshMIGPerform()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#9  0x979b28db __CFRunLoopRun()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#10 0x979b0864 CFRunLoopRunSpecific()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#11 0x979b0691 CFRunLoopRunInMode()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#12 0x973c9f0c RunCurrentEventLoopInMode()
(/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
#13 0x973c9cc3 ReceiveNextEventCommon()
(/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
#14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
(/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
#15 0x91d4eac5 _DPSNextEvent()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#16 0x91d4e306 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#17 0x13a2754b +[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
(/Library/PreferencePanes/Smart Scroll.prefPane/Contents/MacOS/Smart
Scroll.bundle/Contents/MacOS/Smart Scroll)
#18 0x91d1049f +[NSApplication run]
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#19 0x91d08535 NSApplicationMain()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#20 0x0022ca start()  (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
#21 0x02 ??()  (??)

Here is another:

MESSAGE:
"AXValue" attribute unsupported by: 

STACK TRACE:
#0  0x95d86d24 NSExceptionHandlerExceptionRaiser()
(/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
#1  0x9212d509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
#2  0x94dcba21 +[NSException raise]
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#3  0x938de55c NSAccessibilityAttributeValue()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#4  0x93af643f CopyAppKitUIElementAttributeValueNoCatch()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#5  0x93af89d7 CopyAttributeValue()
(/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
#6  0x90b34ad3 _AXXMIGCopyAttributeValue()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#7  0x90b3eb96 _XCopyAttributeValue()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#8  0x90b10c39 mshMIGPerform()
(/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
#9  0x94cec8db __CFRunLoopRun()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#10 0x94cea864 CFRunLoopRunSpecific()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#11 0x94cea691 CFRunLoopRunInMode()
(/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
#12 0x98525f0c RunCurrentEventLoopInMode()
(/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framewo

Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?

2010-02-02 Thread Keary Suska
On Feb 2, 2010, at 8:42 AM, Jerry Krinock wrote:

> So now we have this paradox:
> 
> 1.  "Cocoa Bindings Programming Topics" says that bindings are bidirectional.
> 2.  bind:toObject:withKeyPath:options: documentation says it "establishes a 
> binding"
> 3.  bind:toObject:withKeyPath:options: implementation establishes something 
> which
>is unidirectional.

No paradox, as I see it, because #3 is not precisely true. There is nothing in 
the docs that says it is unidirectional, except in the sense that there is 
always an active and passive partner (perhaps what Quincey meant by 
"asymmetrical").

As I understand the basic implementation of bind:toObject:withKeyPath:options: 

a. The receiver reads the value of keyPath of object, ostensibly storing it in 
its bound property (1st argument), then starts KVO on the object for key path.

b. Any time the receiver changes the bound property it issues a 
setValue:forKeyPath: message to the bound-to object.

c. Any time the receiver receives an observeValueForKeyPath: message from the 
bound-to object, it reads the value of keyPath of object, ostensibly storing it 
in a property identified by the first argument.

So, per the above, there is communication going both ways: the receiver is the 
active partner, doing a push-pull. The bound-to object doesn't even know 
(outside of the scope of KVO) that it is bound to another object, and doesn't 
do anything in that regard. In this sense, and in this sense alone, we could 
say that the binding is unidirectional.

Throwing my 2¢ into the mix,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Corbin Dunn
Oleg,

I think you are misinterpreting an exception being raised as a crash of your 
application. The bt's below are not crashes; they are exceptions being raised 
(and caught) by appkit's accessibility.

I understand that you have a problem with your app crashing -- do you have some 
actual crash reports? If so, reply with those to the list and we may be able to 
help you.

-corbin

On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:

> Hi,
> 
> After publishing an update of my app, I have received quite a few
> crash dumps with very weird stack traces that I cannot understand and
> fix.
> 
> Namely, the exception message says that AXTitle, or AXWindow or
> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
> NSApplication and others. Does it have something to do with
> accessibility? In what way?
> 
> If someone knows what's that supposed to mean, a quick response would
> be very much appreciated. This is an emergency for me.
> 
> Here's one of those logs (All those users are running Snow Leopard 10.6.2):
> 
> MESSAGE:
> "AXTitle" attribute unsupported by: 
> 
> STACK TRACE:
> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
> #2  0x97a91a21 +[NSException raise]
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #3  0x91d9a55c NSAccessibilityAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #5  0x91fb49d7 CopyAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #7  0x94775b96 _XCopyAttributeValue()
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #8  0x94747c39 mshMIGPerform()
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #9  0x979b28db __CFRunLoopRun()
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #10 0x979b0864 CFRunLoopRunSpecific()
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #11 0x979b0691 CFRunLoopRunInMode()
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #12 0x973c9f0c RunCurrentEventLoopInMode()
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> #13 0x973c9cc3 ReceiveNextEventCommon()
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> #14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> #15 0x91d4eac5 _DPSNextEvent()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #16 0x91d4e306 -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #17 0x13a2754b +[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> (/Library/PreferencePanes/Smart Scroll.prefPane/Contents/MacOS/Smart
> Scroll.bundle/Contents/MacOS/Smart Scroll)
> #18 0x91d1049f +[NSApplication run]
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #19 0x91d08535 NSApplicationMain()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #20 0x0022ca start()  (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
> #21 0x02 ??()  (??)
> 
> Here is another:
> 
> MESSAGE:
> "AXValue" attribute unsupported by: 
> 
> STACK TRACE:
> #0  0x95d86d24 NSExceptionHandlerExceptionRaiser()
> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
> #1  0x9212d509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
> #2  0x94dcba21 +[NSException raise]
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #3  0x938de55c NSAccessibilityAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #4  0x93af643f CopyAppKitUIElementAttributeValueNoCatch()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #5  0x93af89d7 CopyAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #6  0x90b34ad3 _AXXMIGCopyAttributeValue()
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #7  0x90b3eb96 _XCopyAttributeValue()
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #8  0x90b10c39 ms

Re: Arbitrary Attributes affect text layout

2010-02-02 Thread Douglas Davidson

On Feb 2, 2010, at 9:48 AM, Philip White wrote:

>   I have a problem I can't quite figure out. I have a program that displays 
> some Hebrew text. I notice that at times some of the vowel markings are not 
> displayed in the correct place. I figured out that this happened when I had 
> applied some arbitrary attributes to that range of text.
>  I was under the impression that one could set any key value pair not used by 
> the Cocoa text system to a part of an attributed string without consequence.

I'd suggest you see what happens when you apply attributes to clusters, using 
rangeOfComposedCharacterSequenceAtIndex: et al., rather than to individual 
characters.  

Douglas Davidson

___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Oleg Krupnov
Hi Corbin,

Thanks for your quick response. You are right, I should have been more
specific. This is not a "crash" in precise meaning. This is an
unhandled exception raised by appkit's accessibility and caught by my
crash reporter facility that prints the stack trace and sends it to me
by e-mail. There is no real, severe crash like that one when you see
the Apple's crash report dialog.

The question is -- why this exception is raised? I don't even mention
anything related to AX anywhere in my app. I must confess I have never
even read the accessibility section of the docs and don't know what it
is.

>From the stack trace it appears that the exception occurs even before
any of my own code is entered,  somewhere in system frameworks.

And it happens only on selected Macs.

Do you have any idea?

Thanks.

On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
> Oleg,
>
> I think you are misinterpreting an exception being raised as a crash of your 
> application. The bt's below are not crashes; they are exceptions being raised 
> (and caught) by appkit's accessibility.
>
> I understand that you have a problem with your app crashing -- do you have 
> some actual crash reports? If so, reply with those to the list and we may be 
> able to help you.
>
> -corbin
>
> On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>
>> Hi,
>>
>> After publishing an update of my app, I have received quite a few
>> crash dumps with very weird stack traces that I cannot understand and
>> fix.
>>
>> Namely, the exception message says that AXTitle, or AXWindow or
>> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
>> NSApplication and others. Does it have something to do with
>> accessibility? In what way?
>>
>> If someone knows what's that supposed to mean, a quick response would
>> be very much appreciated. This is an emergency for me.
>>
>> Here's one of those logs (All those users are running Snow Leopard 10.6.2):
>>
>> MESSAGE:
>> "AXTitle" attribute unsupported by: 
>>
>> STACK TRACE:
>> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
>> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>> #2  0x97a91a21 +[NSException raise]
>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> #3  0x91d9a55c NSAccessibilityAttributeValue()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #5  0x91fb49d7 CopyAttributeValue()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> #7  0x94775b96 _XCopyAttributeValue()
>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> #8  0x94747c39 mshMIGPerform()
>> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> #9  0x979b28db __CFRunLoopRun()
>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> #10 0x979b0864 CFRunLoopRunSpecific()
>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> #11 0x979b0691 CFRunLoopRunInMode()
>> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> #12 0x973c9f0c RunCurrentEventLoopInMode()
>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>> #13 0x973c9cc3 ReceiveNextEventCommon()
>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>> #14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
>> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>> #15 0x91d4eac5 _DPSNextEvent()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #16 0x91d4e306 -[NSApplication
>> nextEventMatchingMask:untilDate:inMode:dequeue:]()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #17 0x13a2754b +[NSApplication
>> nextEventMatchingMask:untilDate:inMode:dequeue:]
>> (/Library/PreferencePanes/Smart Scroll.prefPane/Contents/MacOS/Smart
>> Scroll.bundle/Contents/MacOS/Smart Scroll)
>> #18 0x91d1049f +[NSApplication run]
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #19 0x91d08535 NSApplicationMain()
>> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> #20 0x0022ca start()  (/Applications/DaisyDisk.app/Contents/MacOS/DaisyDisk)
>> #21 0x02 ??()  (??)
>>
>> Here is another:
>>
>> MESSAGE:
>> "AXValue" attribute unsupported by: 
>>
>> STACK TRACE:
>> #0  0x95d86d24 NSExceptionHandlerExceptionRaiser()
>> (/System/Library/Frame

Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Ken Ferry
Hi Oleg,

Unfortunately, the accessibility mechanism uses unexceptional exceptions
under the hood.  These are a normal part of operation.  They shouldn't be
unhandled though… are you sure you're reporting what you think you are?

-Ken

On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  wrote:

> Hi Corbin,
>
> Thanks for your quick response. You are right, I should have been more
> specific. This is not a "crash" in precise meaning. This is an
> unhandled exception raised by appkit's accessibility and caught by my
> crash reporter facility that prints the stack trace and sends it to me
> by e-mail. There is no real, severe crash like that one when you see
> the Apple's crash report dialog.
>
> The question is -- why this exception is raised? I don't even mention
> anything related to AX anywhere in my app. I must confess I have never
> even read the accessibility section of the docs and don't know what it
> is.
>
> >From the stack trace it appears that the exception occurs even before
> any of my own code is entered,  somewhere in system frameworks.
>
> And it happens only on selected Macs.
>
> Do you have any idea?
>
> Thanks.
>
> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
> > Oleg,
> >
> > I think you are misinterpreting an exception being raised as a crash of
> your application. The bt's below are not crashes; they are exceptions being
> raised (and caught) by appkit's accessibility.
> >
> > I understand that you have a problem with your app crashing -- do you
> have some actual crash reports? If so, reply with those to the list and we
> may be able to help you.
> >
> > -corbin
> >
> > On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
> >
> >> Hi,
> >>
> >> After publishing an update of my app, I have received quite a few
> >> crash dumps with very weird stack traces that I cannot understand and
> >> fix.
> >>
> >> Namely, the exception message says that AXTitle, or AXWindow or
> >> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
> >> NSApplication and others. Does it have something to do with
> >> accessibility? In what way?
> >>
> >> If someone knows what's that supposed to mean, a quick response would
> >> be very much appreciated. This is an emergency for me.
> >>
> >> Here's one of those logs (All those users are running Snow Leopard
> 10.6.2):
> >>
> >> MESSAGE:
> >> "AXTitle" attribute unsupported by: 
> >>
> >> STACK TRACE:
> >> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
> >>
> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
> >> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
> >> #2  0x97a91a21 +[NSException raise]
> >>
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> >> #3  0x91d9a55c NSAccessibilityAttributeValue()
> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> >> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> >> #5  0x91fb49d7 CopyAttributeValue()
> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> >> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
> >>
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> >> #7  0x94775b96 _XCopyAttributeValue()
> >>
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> >> #8  0x94747c39 mshMIGPerform()
> >>
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> >> #9  0x979b28db __CFRunLoopRun()
> >>
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> >> #10 0x979b0864 CFRunLoopRunSpecific()
> >>
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> >> #11 0x979b0691 CFRunLoopRunInMode()
> >>
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> >> #12 0x973c9f0c RunCurrentEventLoopInMode()
> >>
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> >> #13 0x973c9cc3 ReceiveNextEventCommon()
> >>
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> >> #14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
> >>
> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
> >> #15 0x91d4eac5 _DPSNextEvent()
> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> >> #16 0x91d4e306 -[NSApplication
> >> nextEventMatchingMask:untilDate:inMode:dequeue:]()
> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> >> #17 0x13a2754b +[NSApplication
> >> nextEventMatchingMask:untilDate:inMode:dequeue:]
> >> (/Library/PreferencePanes/Smart Scroll.prefPane/Contents/MacOS/Smart
> >> Scroll.bundle/Contents/MacOS/Smart Scroll)
> >> #1

Re: Opening dual NSStreams synchronously

2010-02-02 Thread Richard Penwell
In case anyone wants the solution to this puzzle ;-)

while (([inputStream streamStatus] & [outputStream streamStatus]) == 
NSStreamStatusOpening && [[NSRunLoop currentRunLoop] 
runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);

That line will pump the asynchronous events and test that both streams are 
open. It should also include a timeout value as well.

On Feb 2, 2010, at 11:38 AM, Richard Penwell wrote:

> Hello Devs,
> 
> I'd like some feedback on my design here as I'm building an API that I hope 
> will be of use to the community, and some of the finer nuances of Cocoa still 
> escape me.
> 
> I'm building a class called TDSConnection which is part of a object graph 
> providing connectivity to the Tabular Data Stream format in objective-c.  
> (TDS is the Microsoft SQL protocol).  What I've got is some interesting 
> threading and synchronization issues.  The one that I'm trying to check for 
> correctness currently is thus:
> 
> I have a method -[TDSConnection open] which should open two NSStreams (input 
> and output), block until both are open or erred then perform the TDS packets 
> for login.  The method of doing this for me looks like this:
> 
> - (void)open
> {
>   [self close];
>   
>   [NSStream getStreamsToHost:host 
> port:port 
>  inputStream:&inputStream 
> outputStream:&outputStream];
>   
>   [inputStream setDelegate:self];
>   [outputStream setDelegate:self];
>   
>   [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] 
>  
> forMode:NSDefaultRunLoopMode];
>   [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] 
>   
> forMode:NSDefaultRunLoopMode];
>   
>   [inputStreamCondition lock];
>   [outputStreamCondition lock];
>   [inputStream open];
>   [outputStream open];
>   
>   [inputStreamCondition wait];
>   [outputStreamCondition wait];
> }
> 
> - (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode
> {
>   if (stream == inputStream) {
>   [self handleInputStreamEvent:eventCode];
>   } else if (stream == outputStream) {
>   [self handleOutputStreamEvent:eventCode];
>   } else {
>   NSLog(@"Recieved a stream event for instance %@ which was not 
> the input or output stream", stream);
>   }
> }
> 
> - (void)handleInputStreamEvent:(NSStreamEvent)eventCode {
>   switch (eventCode) {
>   case NSStreamEventOpenCompleted:
>   [inputStreamCondition signal];
>   break;
>   default:
>   break;
>   }
> }
> 
> - (void)handleOutputStreamEvent:(NSStreamEvent)eventCode {
>   switch (eventCode) {
>   case NSStreamEventOpenCompleted:
>   [outputStreamCondition signal];
>   break;
>   default:
>   break;
>   }
> }
> 
> As can be seen, I am using a NSCondition to block the main thread until I 
> receive both NSStreamEventOpenCompleted events.
> 
> I have a feeling that this code smells a bit, and was wondering if someone 
> who's done some networking programming has recommendations.
> 
> 
> Grateful as always,
> Richard
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/almightylinuxgod%40me.com
> 
> This email sent to almightylinux...@me.com

___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Oleg Krupnov
Thanks Ken,

I don't quite understand your response though. What do you mean by
"unexceptional exceptions"? How should I handle those exceptions, and
why should I, if I don't make any calls to accessibility frameworks at
all?

The report I have included in the first post is all I have so far.



On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
> Hi Oleg,
> Unfortunately, the accessibility mechanism uses unexceptional exceptions
> under the hood.  These are a normal part of operation.  They shouldn't be
> unhandled though… are you sure you're reporting what you think you are?
> -Ken
> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  wrote:
>>
>> Hi Corbin,
>>
>> Thanks for your quick response. You are right, I should have been more
>> specific. This is not a "crash" in precise meaning. This is an
>> unhandled exception raised by appkit's accessibility and caught by my
>> crash reporter facility that prints the stack trace and sends it to me
>> by e-mail. There is no real, severe crash like that one when you see
>> the Apple's crash report dialog.
>>
>> The question is -- why this exception is raised? I don't even mention
>> anything related to AX anywhere in my app. I must confess I have never
>> even read the accessibility section of the docs and don't know what it
>> is.
>>
>> >From the stack trace it appears that the exception occurs even before
>> any of my own code is entered,  somewhere in system frameworks.
>>
>> And it happens only on selected Macs.
>>
>> Do you have any idea?
>>
>> Thanks.
>>
>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
>> > Oleg,
>> >
>> > I think you are misinterpreting an exception being raised as a crash of
>> > your application. The bt's below are not crashes; they are exceptions being
>> > raised (and caught) by appkit's accessibility.
>> >
>> > I understand that you have a problem with your app crashing -- do you
>> > have some actual crash reports? If so, reply with those to the list and we
>> > may be able to help you.
>> >
>> > -corbin
>> >
>> > On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>> >
>> >> Hi,
>> >>
>> >> After publishing an update of my app, I have received quite a few
>> >> crash dumps with very weird stack traces that I cannot understand and
>> >> fix.
>> >>
>> >> Namely, the exception message says that AXTitle, or AXWindow or
>> >> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
>> >> NSApplication and others. Does it have something to do with
>> >> accessibility? In what way?
>> >>
>> >> If someone knows what's that supposed to mean, a quick response would
>> >> be very much appreciated. This is an emergency for me.
>> >>
>> >> Here's one of those logs (All those users are running Snow Leopard
>> >> 10.6.2):
>> >>
>> >> MESSAGE:
>> >> "AXTitle" attribute unsupported by: 
>> >>
>> >> STACK TRACE:
>> >> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
>> >>
>> >> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>> >> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>> >> #2  0x97a91a21 +[NSException raise]
>> >>
>> >> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> >> #3  0x91d9a55c NSAccessibilityAttributeValue()
>> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> >> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
>> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> >> #5  0x91fb49d7 CopyAttributeValue()
>> >> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
>> >> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
>> >>
>> >> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> >> #7  0x94775b96 _XCopyAttributeValue()
>> >>
>> >> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> >> #8  0x94747c39 mshMIGPerform()
>> >>
>> >> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
>> >> #9  0x979b28db __CFRunLoopRun()
>> >>
>> >> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> >> #10 0x979b0864 CFRunLoopRunSpecific()
>> >>
>> >> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> >> #11 0x979b0691 CFRunLoopRunInMode()
>> >>
>> >> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
>> >> #12 0x973c9f0c RunCurrentEventLoopInMode()
>> >>
>> >> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>> >> #13 0x973c9cc3 ReceiveNextEventCommon()
>> >>
>> >> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
>> >> #14 0x973c9b48 BlockUntilNextEventMatchingListInMode()
>> >>
>> >> (/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versio

Re: Arbitrary Attributes affect text layout

2010-02-02 Thread Philip White
On Feb 2, 2010, at 12:34 PM, Douglas Davidson wrote:

> rangeOfComposedCharacterSequenceAtIndex

Hello, thanks for the quick response. I didn't know that attributes couldn't be 
applied to only parts of composed character sequence ranges. When I only apply 
attributes to ranges returned by rangeOfComposedCharacterSequenceAtIndex: I 
don't have any text mangling. That should solve my problem.

Thanks again,
  Philip White
___

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

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


Custom Field Editor Problem

2010-02-02 Thread John Nairn
I copied code from Cocoa documentation to create a custom field  
editor. It gets created OK and seems to work, but always crashes when  
the the window closes with the message


Program received signal:  “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

I created the custom editor in the window controller using code from  
Apple:


- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id) 
anObject

{   
if([anObject isKindOfClass:[NSTextField class]])
{   if(!customEditor)
{   customEditor=[[BrowserFieldEditor alloc] init];
[customEditor setFieldEditor:YES];
}
return customEditor;
}
return nil;
}

When the window controller is deallocated, it calls

[customEditor dealloc];

Finally, the entire custom editor, which is NSTextView subclass, is

@implementation BrowserFieldEditor

- (id)init
{   if(self=[super init])
{   NSLog(@"init field editor");
}
return self;
}

- (void)dealloc
{NSLog(@"dealloc field editor");
[super dealloc];
}

@end

The "init field editor" message appears when created and the "dealloc  
field editor" appears just before the crash.  If I change the window  
controller to not release the custom editor, the crash stops, but the  
"dealloc field editor" message never appears (i.e., a memory leak).  
Also the Apple documentation explicitly says:


The custom field editor should be released in an appropriate place,  
such as the dealloc method of the window delegate object (if the field  
editor was never instantiated, therelease message has no effect and is  
harmless).



John Nairn
http://www.geditcom.com
Genealogy Software for the Mac

___

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

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


Re: NSTableView questions (take 2)

2010-02-02 Thread Matthew Weinstein
Problem somewhat solved. Landed up subclassing nstableview and  
overriding mouseDown:

Works well (at least on my machine).

On Feb 2, 2010, at 9:08 AM, Corbin Dunn wrote:

Table b should be set to setAllowsMultipleSelection:NO. However,  
despite that, you can programmatically change the selection yourself  
with -setSelectedRowIndexes:byExtendingSelection: when the selection  
in Table A changes.


--corbin

I have 2 tables that basically have a many to many relationship. If  
I click on table A I want multiple values of table B to be  
selected; but I click on table B I want to make sure I can't select  
multiple values


On Feb 2, 2010, at 8:53 AM, Corbin Dunn wrote:



On Feb 2, 2010, at 8:32 AM, Matthew Weinstein wrote:

Still trying to find a way to turn off setAllowsMultipleSelection  
just as the table becomes the responder. Is there some way of  
anticipating this, a "willbecomefirstresponder" kind of a  
notification?


What are you really trying to do? Or, in other words, what is the  
goal with doing this?


--corbin





___

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

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


Re: Arbitrary Attributes affect text layout

2010-02-02 Thread Douglas Davidson

On Feb 2, 2010, at 11:00 AM, Philip White wrote:

> Hello, thanks for the quick response. I didn't know that attributes couldn't 
> be applied to only parts of composed character sequence ranges. When I only 
> apply attributes to ranges returned by 
> rangeOfComposedCharacterSequenceAtIndex: I don't have any text mangling. That 
> should solve my problem.

Generally speaking, most text manipulation should work in units of character 
clusters rather than individual characters, since the cluster is effectively 
the user-perceived character unit.  I suppose there might be potential uses for 
such things as e.g. applying one color to a base character and another color to 
a diacritic attached to it, but this is not something that fonts will reliably 
support in general.  The Cocoa text system still should handle these sorts of 
situations reasonably, so you should file a bug about the problems you have 
been seeing, but I'd suggest using rangeOfComposedCharacterSequenceAtIndex: and 
the like as a workaround.

Douglas Davidson

___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Jesper Storm Bache
Are you sure you are seeing "unhandled exceptions", or simply "NSExceptions" 
that are handled somewhere inside the Ax framework.
If it is the latter, then you'll need to allow NSExceptions from inside the Ax 
framework to propagate to their handlers (also inside the Ax framework).
Note: Apple does *not* guarantee that their implementation is NSException free; 
you just should not see such exceptions being thrown back to your code.

For this reason I only enable NSException detection logic in my debug builds, 
and the current version of my debug handler is:

void ExceptionCallback(id exceptionObject)
{
bool doBreak = true;
if ([exceptionObject isKindOfClass:[NSException class]])
{
NSString* name = [exceptionObject name];

// Ignore exceptions from the accessibility framework because 
it uses
// exceptions for flow control
doBreak = ![name isEqualToString:NSAccessibilityException];
}

if (doBreak)
{
report_problem(...)
}
}

Jesper Storm Bache

On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:

> Thanks Ken,
>
> I don't quite understand your response though. What do you mean by
> "unexceptional exceptions"? How should I handle those exceptions, and
> why should I, if I don't make any calls to accessibility frameworks at
> all?
>
> The report I have included in the first post is all I have so far.
>
>
>
> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
>> Hi Oleg,
>> Unfortunately, the accessibility mechanism uses unexceptional exceptions
>> under the hood.  These are a normal part of operation.  They shouldn't be
>> unhandled though… are you sure you're reporting what you think you are?
>> -Ken
>> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  wrote:
>>>
>>> Hi Corbin,
>>>
>>> Thanks for your quick response. You are right, I should have been more
>>> specific. This is not a "crash" in precise meaning. This is an
>>> unhandled exception raised by appkit's accessibility and caught by my
>>> crash reporter facility that prints the stack trace and sends it to me
>>> by e-mail. There is no real, severe crash like that one when you see
>>> the Apple's crash report dialog.
>>>
>>> The question is -- why this exception is raised? I don't even mention
>>> anything related to AX anywhere in my app. I must confess I have never
>>> even read the accessibility section of the docs and don't know what it
>>> is.
>>>
 From the stack trace it appears that the exception occurs even before
>>> any of my own code is entered,  somewhere in system frameworks.
>>>
>>> And it happens only on selected Macs.
>>>
>>> Do you have any idea?
>>>
>>> Thanks.
>>>
>>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
 Oleg,

 I think you are misinterpreting an exception being raised as a crash of
 your application. The bt's below are not crashes; they are exceptions being
 raised (and caught) by appkit's accessibility.

 I understand that you have a problem with your app crashing -- do you
 have some actual crash reports? If so, reply with those to the list and we
 may be able to help you.

 -corbin

 On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:

> Hi,
>
> After publishing an update of my app, I have received quite a few
> crash dumps with very weird stack traces that I cannot understand and
> fix.
>
> Namely, the exception message says that AXTitle, or AXWindow or
> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
> NSApplication and others. Does it have something to do with
> accessibility? In what way?
>
> If someone knows what's that supposed to mean, a quick response would
> be very much appreciated. This is an emergency for me.
>
> Here's one of those logs (All those users are running Snow Leopard
> 10.6.2):
>
> MESSAGE:
> "AXTitle" attribute unsupported by: 
>
> STACK TRACE:
> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
>
> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
> #2  0x97a91a21 +[NSException raise]
>
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #3  0x91d9a55c NSAccessibilityAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #5  0x91fb49d7 CopyAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
>
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #7  0x94775b96 _XCopyAttributeValue()
>
> (/Syste

Re: Opening dual NSStreams synchronously

2010-02-02 Thread Jens Alfke


On Feb 2, 2010, at 10:56 AM, Richard Penwell wrote:

while (([inputStream streamStatus] & [outputStream streamStatus]) ==  
NSStreamStatusOpening && [[NSRunLoop currentRunLoop]  
runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);



There are a couple of problems here...

(1) That test of the stream's statuses looks wrong. NSStreamStatus is  
an enumeration, not a bit-field type, so and'ing two values together  
doesn't create a meaningful result. I think the test you want is
	([inputStream streamStatus] == NSStreamStatusOpening || [outputStream  
streamStatus] == NSStreamStatusOpening)

i.e. "wait until both streams are no longer opening".

(2) Running the runloop in default mode is quite dangerous, because  
it'll be receiving and processing all kinds of activities like user  
events, perform-after-delay calls, delegate calls from asynchronous  
operations, etc. All of these will be running re-entrantly in the  
middle of your open method, and this can cause really strange things  
to happen. If you must crank the runloop this way, make up a custom  
mode string and use that.


(3) At a higher level, it would be better to design your code so that  
it didn't have blocking semantics. You're going against the grain of  
the way Cocoa works here. In general, in an API like this, the 'open'  
call should return immediately, with a later delegate call or  
notification to let the client know when the status changes.


—Jens___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Corbin Dunn
Oleg, 

In addition to what Ken and Jesper said, you should be able to repro the 
problem yourself. Just turn on accessibility in System Prefs, and start 
something like "Accessibility Inspector" 
(/Developer/Applications/Utilities/Accessability tools)


..corbin


On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:

> Thanks Ken,
> 
> I don't quite understand your response though. What do you mean by
> "unexceptional exceptions"? How should I handle those exceptions, and
> why should I, if I don't make any calls to accessibility frameworks at
> all?
> 
> The report I have included in the first post is all I have so far.
> 
> 
> 
> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
>> Hi Oleg,
>> Unfortunately, the accessibility mechanism uses unexceptional exceptions
>> under the hood.  These are a normal part of operation.  They shouldn't be
>> unhandled though… are you sure you're reporting what you think you are?
>> -Ken
>> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  wrote:
>>> 
>>> Hi Corbin,
>>> 
>>> Thanks for your quick response. You are right, I should have been more
>>> specific. This is not a "crash" in precise meaning. This is an
>>> unhandled exception raised by appkit's accessibility and caught by my
>>> crash reporter facility that prints the stack trace and sends it to me
>>> by e-mail. There is no real, severe crash like that one when you see
>>> the Apple's crash report dialog.
>>> 
>>> The question is -- why this exception is raised? I don't even mention
>>> anything related to AX anywhere in my app. I must confess I have never
>>> even read the accessibility section of the docs and don't know what it
>>> is.
>>> 
 From the stack trace it appears that the exception occurs even before
>>> any of my own code is entered,  somewhere in system frameworks.
>>> 
>>> And it happens only on selected Macs.
>>> 
>>> Do you have any idea?
>>> 
>>> Thanks.
>>> 
>>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
 Oleg,
 
 I think you are misinterpreting an exception being raised as a crash of
 your application. The bt's below are not crashes; they are exceptions being
 raised (and caught) by appkit's accessibility.
 
 I understand that you have a problem with your app crashing -- do you
 have some actual crash reports? If so, reply with those to the list and we
 may be able to help you.
 
 -corbin
 
 On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
 
> Hi,
> 
> After publishing an update of my app, I have received quite a few
> crash dumps with very weird stack traces that I cannot understand and
> fix.
> 
> Namely, the exception message says that AXTitle, or AXWindow or
> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
> NSApplication and others. Does it have something to do with
> accessibility? In what way?
> 
> If someone knows what's that supposed to mean, a quick response would
> be very much appreciated. This is an emergency for me.
> 
> Here's one of those logs (All those users are running Snow Leopard
> 10.6.2):
> 
> MESSAGE:
> "AXTitle" attribute unsupported by: 
> 
> STACK TRACE:
> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
> 
> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
> #2  0x97a91a21 +[NSException raise]
> 
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #3  0x91d9a55c NSAccessibilityAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #4  0x91fb243f CopyAppKitUIElementAttributeValueNoCatch()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #5  0x91fb49d7 CopyAttributeValue()
> (/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
> #6  0x9476bad3 _AXXMIGCopyAttributeValue()
> 
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #7  0x94775b96 _XCopyAttributeValue()
> 
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #8  0x94747c39 mshMIGPerform()
> 
> (/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices)
> #9  0x979b28db __CFRunLoopRun()
> 
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #10 0x979b0864 CFRunLoopRunSpecific()
> 
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #11 0x979b0691 CFRunLoopRunInMode()
> 
> (/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation)
> #12 0x973c9f0c RunCurrentEventLoopInMode()
> 
> (/System/Library/Frameworks/Carbon.framewor

Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Jens Alfke


On Feb 2, 2010, at 11:09 AM, Jesper Storm Bache wrote:

Note: Apple does *not* guarantee that their implementation is  
NSException free; you just should not see such exceptions being  
thrown back to your code.


Agreed. In some cases exceptions are thrown internally but then  
caught, so they have no effect on your code. The most prominent case  
of this is anything that uses Distributed Objects under the hood,  
because any call to a remote object can throw an exception if  
something goes wrong with the connection. If you're watching all  
exceptions being raised, it's good to explicitly ignore the exceptions  
defined by DO.


—Jens___

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

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


Re: Opening dual NSStreams synchronously

2010-02-02 Thread Richard Penwell
Very true on the overall method, I'd prefer to make the whole thing 
asynchronous, but thus far cannot figure out how to wrangle SenTestKit into 
handling test methods that pass when a delegate method is called... 

On Feb 2, 2010, at 2:18 PM, Jens Alfke wrote:

> 
> On Feb 2, 2010, at 10:56 AM, Richard Penwell wrote:
> 
>> while (([inputStream streamStatus] & [outputStream streamStatus]) == 
>> NSStreamStatusOpening && [[NSRunLoop currentRunLoop] 
>> runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);
> 
> 
> There are a couple of problems here...
> 
> (1) That test of the stream's statuses looks wrong. NSStreamStatus is an 
> enumeration, not a bit-field type, so and'ing two values together doesn't 
> create a meaningful result. I think the test you want is
>   ([inputStream streamStatus] == NSStreamStatusOpening || [outputStream 
> streamStatus] == NSStreamStatusOpening)
> i.e. "wait until both streams are no longer opening".
> 
> (2) Running the runloop in default mode is quite dangerous, because it'll be 
> receiving and processing all kinds of activities like user events, 
> perform-after-delay calls, delegate calls from asynchronous operations, etc. 
> All of these will be running re-entrantly in the middle of your open method, 
> and this can cause really strange things to happen. If you must crank the 
> runloop this way, make up a custom mode string and use that.
> 
> (3) At a higher level, it would be better to design your code so that it 
> didn't have blocking semantics. You're going against the grain of the way 
> Cocoa works here. In general, in an API like this, the 'open' call should 
> return immediately, with a later delegate call or notification to let the 
> client know when the status changes.
> 
> —Jens

___

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

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


Re: [MEET] February CocoaHeads Developer Meetings

2010-02-02 Thread Fritz Anderson
On 2 Feb 2010, at 4:17 AM, Symadept wrote:

> Why can't it be possible in Singapore?
> 
> -Mustafa
> 
> On Fri, Jan 29, 2010 at 11:20 AM, Stephen Zyszkiewicz
> wrote:
...
>> 
>> Some chapters may have yet to post their meeting for next month. Meeting
>> times may change. Locations and more information here:
>> http://cocoaheads.org
>> 
>> Also be sure to check for an NSCoder Night in your area:
>> http://nscodernight.com/
> 

Nobody (that I'm aware of) is making it impossible. CocoaHeads is a network of 
privately-organized, voluntary meetings. If you want a CocoaHeads group, feel 
free to organize one. See the links Stephen provided.

— F

___

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

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


Core Data - Need an Observer but where and how to implement

2010-02-02 Thread Andreas Grauel
Hello,

following situation. I have two Entities - Person and Event - both are with
a many to many relationship, because a person can have more events and a
event can have more persons. After I have added a few Persons to an Event
I'd like to display them on in a Table. But how? I tried a Binding with
Events - selection - person.firstName but then always comes this Error.

2010-02-02 20:37:39.948 Kegeln[4128:a0f] [<_NSFaultingMutableSet
0x100227180> addObserver:forKeyPath:options:context:] is not supported. Key
path: firstName
*
*
I also have tried some other things but cannot figure it out. I have also
tried to add an Observer but wasn't able to. I have tried to add an Observer
to the EventArrayController, but didn't work or maybe i did it wrong. What
can i do? Please help.

Regards,
Andreas
___

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

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


Analyzer Questions

2010-02-02 Thread Bob Barnes
Hi all,

   I've recently upgraded to Mac OS X 10.6.2 in order to run the Analyzer for 
Xcode and it's pointing out some potential memory leaks that really have me 
confused. A typical example is where I have a method that allocates and returns 
something like a CGPDFDocumentRef or CGContextRef. The analyzer reports that  
the object allocated and stored in the variable is potentially being leaked, 
however, if I call the appropriate release, such as CGPDFDocumentRelease or 
CGContextRelease in the calling method it's reported as an incorrect decrement 
of an object not owned by the caller. 

   Is this just a limitation in the ability of the Analyzer to track the 
allocation/freeing of an object or am I missing something fundamental. 

Sample below:

- (id)callingMethod: {  
CGPDFDocumentRefdocumentRef;
const char  *buffer;

snip...

documentRef = [self getPDFDocumentRef:buffer];

snip...

CGPDFDocumentRelease(documentRef);

return x;
}

- (CGPDFDocumentRef)getPDFDocumentRef:(const char *)filename { 
CGPDFDocumentRefdocument; 

snip...

document = CGPDFDocumentCreateWithURL(url); 
return document; 
} 


thanks,

Bob___

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

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


Buttons in Xcode's Data Model Window

2010-02-02 Thread Glen Simmons
I like the look of the little buttons in the bottom left of the Entity and
Property table views in Xcode's Data Model window. I can't seem to get a
combination of settings on an NSButton to emulate them though. Particularly,
the blue highlight on click, but also the popup behavior, with an image. I'm
guessing they're custom, but thought I'd ask.

Thanks,
Glen
___

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

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


Re: [MEET] February CocoaHeads Developer Meetings

2010-02-02 Thread Stephen Zyszkiewicz

Please see the Facebook group:
http://www.facebook.com/group.php?v=wall&gid=29368309964

or contact the organizer HongTing Wong:
wong...@gmail.com


Thanks,
Steve

On Feb 2, 2010, at 11:05 AM, Fritz Anderson wrote:


On 2 Feb 2010, at 4:17 AM, Symadept wrote:


Why can't it be possible in Singapore?

-Mustafa

On Fri, Jan 29, 2010 at 11:20 AM, Stephen Zyszkiewicz
wrote:

...


Some chapters may have yet to post their meeting for next month.  
Meeting

times may change. Locations and more information here:
http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/




Nobody (that I'm aware of) is making it impossible. CocoaHeads is a  
network of privately-organized, voluntary meetings. If you want a  
CocoaHeads group, feel free to organize one. See the links Stephen  
provided.


— F



___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Oleg Krupnov
Fixed now, it worked like a charm! :)

Indeed, I was intercepting exceptions from the AX framework in my -
(BOOL)exceptionHandler:(NSExceptionHandler*)sender
shouldHandleException:(NSException*)exception mask:(unsigned int)mask
delegate method. This only occurs on Snow Leopard but not on Leopard.
I was able to reproduce the bug using the Accessibility Inspector
utility. And I have fixed it as advised.

Thanks a ton to everybody who responded!!!


On Tue, Feb 2, 2010 at 9:09 PM, Jesper Storm Bache  wrote:
> Are you sure you are seeing "unhandled exceptions", or simply "NSExceptions" 
> that are handled somewhere inside the Ax framework.
> If it is the latter, then you'll need to allow NSExceptions from inside the 
> Ax framework to propagate to their handlers (also inside the Ax framework).
> Note: Apple does *not* guarantee that their implementation is NSException 
> free; you just should not see such exceptions being thrown back to your code.
>
> For this reason I only enable NSException detection logic in my debug builds, 
> and the current version of my debug handler is:
>
> void ExceptionCallback(id exceptionObject)
> {
>        bool doBreak = true;
>        if ([exceptionObject isKindOfClass:[NSException class]])
>        {
>                NSString* name = [exceptionObject name];
>
>                // Ignore exceptions from the accessibility framework because 
> it uses
>                // exceptions for flow control
>                doBreak = ![name isEqualToString:NSAccessibilityException];
>        }
>
>        if (doBreak)
>        {
>                report_problem(...)
>        }
> }
>
> Jesper Storm Bache
>
> On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:
>
>> Thanks Ken,
>>
>> I don't quite understand your response though. What do you mean by
>> "unexceptional exceptions"? How should I handle those exceptions, and
>> why should I, if I don't make any calls to accessibility frameworks at
>> all?
>>
>> The report I have included in the first post is all I have so far.
>>
>>
>>
>> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
>>> Hi Oleg,
>>> Unfortunately, the accessibility mechanism uses unexceptional exceptions
>>> under the hood.  These are a normal part of operation.  They shouldn't be
>>> unhandled though… are you sure you're reporting what you think you are?
>>> -Ken
>>> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  wrote:

 Hi Corbin,

 Thanks for your quick response. You are right, I should have been more
 specific. This is not a "crash" in precise meaning. This is an
 unhandled exception raised by appkit's accessibility and caught by my
 crash reporter facility that prints the stack trace and sends it to me
 by e-mail. There is no real, severe crash like that one when you see
 the Apple's crash report dialog.

 The question is -- why this exception is raised? I don't even mention
 anything related to AX anywhere in my app. I must confess I have never
 even read the accessibility section of the docs and don't know what it
 is.

> From the stack trace it appears that the exception occurs even before
 any of my own code is entered,  somewhere in system frameworks.

 And it happens only on selected Macs.

 Do you have any idea?

 Thanks.

 On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
> Oleg,
>
> I think you are misinterpreting an exception being raised as a crash of
> your application. The bt's below are not crashes; they are exceptions 
> being
> raised (and caught) by appkit's accessibility.
>
> I understand that you have a problem with your app crashing -- do you
> have some actual crash reports? If so, reply with those to the list and we
> may be able to help you.
>
> -corbin
>
> On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>
>> Hi,
>>
>> After publishing an update of my app, I have received quite a few
>> crash dumps with very weird stack traces that I cannot understand and
>> fix.
>>
>> Namely, the exception message says that AXTitle, or AXWindow or
>> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
>> NSApplication and others. Does it have something to do with
>> accessibility? In what way?
>>
>> If someone knows what's that supposed to mean, a quick response would
>> be very much appreciated. This is an emergency for me.
>>
>> Here's one of those logs (All those users are running Snow Leopard
>> 10.6.2):
>>
>> MESSAGE:
>> "AXTitle" attribute unsupported by: 
>>
>> STACK TRACE:
>> #0  0x98b80d24 NSExceptionHandlerExceptionRaiser()
>>
>> (/System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling)
>> #1  0x94bc5509 objc_exception_throw()  (/usr/lib/libobjc.A.dylib)
>> #2  0x97a91a21 +[NSException raise]
>>
>> (/System/Library/Frameworks/CoreFoundation.frame

Re: Analyzer Questions

2010-02-02 Thread David Duncan
On Feb 2, 2010, at 11:58 AM, Bob Barnes wrote:

>   I've recently upgraded to Mac OS X 10.6.2 in order to run the Analyzer for 
> Xcode and it's pointing out some potential memory leaks that really have me 
> confused. A typical example is where I have a method that allocates and 
> returns something like a CGPDFDocumentRef or CGContextRef. The analyzer 
> reports that  the object allocated and stored in the variable is potentially 
> being leaked, however, if I call the appropriate release, such as 
> CGPDFDocumentRelease or CGContextRelease in the calling method it's reported 
> as an incorrect decrement of an object not owned by the caller. 


The analyzer checks the standard Cocoa/CF ownership model. In short it is 
reporting that a "getter" method (that returns a non-owned instance) is 
returning an owned instance, which it believes may be a memory leak (because 
the caller is not expected to release the object). Similarly it is reporting 
that a method is releasing an object that it does not own (because the method 
used a "getter" to get the object).

Basically, your code doesn't conform to the standard ownership model, which is 
confusing the analyzer. If you renamed your method to "newPDFDocumentRef" then 
the analyzer wouldn't give you either error, as this would be in line with the 
standard ownership model.
--
David Duncan
Apple DTS Animation and Printing

___

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

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


Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?

2010-02-02 Thread Quincey Morris
(Apologies for over-quoting here. And for the length of the response.)

On Feb 2, 2010, at 07:42, Jerry Krinock wrote:

> On 2010 Feb 01, at 03:53, Quincey Morris wrote:
> 
>> I'd point you to the the documentation:
> 
>   (This is the quote from "Cocoa Bindings Programming Topics" the 
> documentation I quoted in my original post.)
> 
>> I don't see how this can be clearer that bindings are bidirectional.
> 
> Yes.  It is clear.  And I had always thought that bindings were 
> bidirectional, based on this documentation.  Then, two weeks ago, I noticed 
> that -bind:::only implemented observer behavior in one direction.  

There's no "observer behavior" *in* NSObject's 'bind:...'. It merely sets up an 
observation -- it does the equivalent of calling 'addObserver:forKeyPath:...'. 
The distinction is key. See below.

> I then read *this* documentation:
> 
>> bind:toObject:withKeyPath:options:
>> 
>> "Establishes a binding between a ..."
> 
> "Establishes a binding!"  So, then, having forgotten the other documentation, 
> I thought like Matt, that bindings are unidirectional.  Until I tried it with 
> an NSButton.

The 'bind:...' *method* isn't a binding. It's a method. It *establishes* a 
binding, but it isn't a binding. Just like [NSArray array] is a method that 
creates an array, but the method isn't the array, nor is the array behavior in 
the method. See below.

> So now we have this paradox:
> 
> 1.  "Cocoa Bindings Programming Topics" says that bindings are bidirectional.
> 2.  bind:toObject:withKeyPath:options: documentation says it "establishes a 
> binding"
> 3.  bind:toObject:withKeyPath:options: implementation establishes something 
> which
>is unidirectional.

On Feb 2, 2010, at 10:06, Keary Suska wrote:

> No paradox, as I see it, because #3 is not precisely true. There is nothing 
> in the docs that says it is unidirectional, except in the sense that there is 
> always an active and passive partner (perhaps what Quincey meant by 
> "asymmetrical").

I agree there's no paradox, but I'd express it differently. There's no paradox 
if a bidirectional thing contains two uni-directional pieces. Not unless you 
confuse the pieces with the thing.

All implementations of 'bind:...' "establish a binding [link]", which is 
bidirectional. NSObject's implementation of 'bind:...' "establishes something 
which is unidirectional" -- namely a KVO observation -- which provides half of 
the necessary binding behavior to subclasses that wish to make use of it. The 
other half (the other direction) is left for individual subclasses to implement.


Let me take another stab at teasing out the strands. Feel free to stop reading 
here if your eyes have already glazed over.

1. There are three (3) [III] agents involved in a binding.

-- Class A (typically some kind of view) defines+implements a binding 
[behavior] identified by an attribute "x". "Attribute" is not the best choice 
of terminology, but it's what the documentation uses. It's basically an 
arbitrary string with a meaning that's internal to A, though sometimes it 
happens to be a KVC property name too. The attribute may or may not be 
"exposed" to IB as a "binding name".

-- Class B (typically a data model object) defines+implements a KVC property 
"y".

-- Class C (typically some kind of controller) is responsible for hooking 
things up. If the binding is set up in IB, C's behavior is somewhere inside the 
nib-loading code. If the binding is established programmatically, C is an 
application-defined class.

2. An object c of class C establishes a binding [link] from attribute "x" of an 
object a of class A to property "y" of an object b of class, by sending this 
message:

[a bind: @"x" toObject: b withKeyPath: @"y" options: ...];

Note that A, B and C are *not* necessarily distinct. Often A == C and a == c:

[self bind: @"x" toObject: b withKeyPath: @"y" options: ...];

In terms of establishing a binding [link], that's the whole story. C does not 
care what the implementation of 'bind:...' is -- that's an implementation 
detail inside A. All C cares about is that sending this message causes the 
binding [link] to exist.

Certainly C knows that 'bind:...' must set up some machinery to make A's 
binding [behavior] work, but it's a mistake to think that this machinery *is* 
the binding [behavior]. That's where the discussion usually goes off the rails. 
The train wreck is made more likely because:

-- there's no proper terminology to distinguish a binding [link] from a binding 
[behavior]

-- NSObject's implementation of 'bind:...' happens to do something that's sort 
of useful in isolation, if class A doesn't actually define binding "x' but has 
a KVC property "x"

It'd be better for everyone, I think, if NSObject had no implementation of 
'bind:...' at all, or if its implementation was moved to a convenience method 
that didn't mention the word "binding".

3. Class A is responsible for providing the binding [behavior]. This consists 
of 

Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Jesper Storm Bache
My advice is: Don't do this in release builds. There is nothing that says that 
Apple in the future will throw more exceptions inside their implementation (in 
a different framework) - and you'll then have to patch your handler again.
Feel free to experiment with this kind of functionality in your debug builds.
Alternatively have a "Debug level" preference that you can have users turn on 
(and off). Make the default "Off".

Jesper

On Feb 2, 2010, at 12:18 PM, Oleg Krupnov wrote:

> Fixed now, it worked like a charm! :)
>
> Indeed, I was intercepting exceptions from the AX framework in my -
> (BOOL)exceptionHandler:(NSExceptionHandler*)sender
> shouldHandleException:(NSException*)exception mask:(unsigned int)mask
> delegate method. This only occurs on Snow Leopard but not on Leopard.
> I was able to reproduce the bug using the Accessibility Inspector
> utility. And I have fixed it as advised.
>
> Thanks a ton to everybody who responded!!!
>
>
> On Tue, Feb 2, 2010 at 9:09 PM, Jesper Storm Bache  wrote:
>> Are you sure you are seeing "unhandled exceptions", or simply "NSExceptions" 
>> that are handled somewhere inside the Ax framework.
>> If it is the latter, then you'll need to allow NSExceptions from inside the 
>> Ax framework to propagate to their handlers (also inside the Ax framework).
>> Note: Apple does *not* guarantee that their implementation is NSException 
>> free; you just should not see such exceptions being thrown back to your code.
>>
>> For this reason I only enable NSException detection logic in my debug 
>> builds, and the current version of my debug handler is:
>>
>> void ExceptionCallback(id exceptionObject)
>> {
>>   bool doBreak = true;
>>   if ([exceptionObject isKindOfClass:[NSException class]])
>>   {
>>   NSString* name = [exceptionObject name];
>>
>>   // Ignore exceptions from the accessibility framework because 
>> it uses
>>   // exceptions for flow control
>>   doBreak = ![name isEqualToString:NSAccessibilityException];
>>   }
>>
>>   if (doBreak)
>>   {
>>   report_problem(...)
>>   }
>> }
>>
>> Jesper Storm Bache
>>
>> On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:
>>
>>> Thanks Ken,
>>>
>>> I don't quite understand your response though. What do you mean by
>>> "unexceptional exceptions"? How should I handle those exceptions, and
>>> why should I, if I don't make any calls to accessibility frameworks at
>>> all?
>>>
>>> The report I have included in the first post is all I have so far.
>>>
>>>
>>>
>>> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
 Hi Oleg,
 Unfortunately, the accessibility mechanism uses unexceptional exceptions
 under the hood.  These are a normal part of operation.  They shouldn't be
 unhandled though… are you sure you're reporting what you think you are?
 -Ken
 On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  
 wrote:
>
> Hi Corbin,
>
> Thanks for your quick response. You are right, I should have been more
> specific. This is not a "crash" in precise meaning. This is an
> unhandled exception raised by appkit's accessibility and caught by my
> crash reporter facility that prints the stack trace and sends it to me
> by e-mail. There is no real, severe crash like that one when you see
> the Apple's crash report dialog.
>
> The question is -- why this exception is raised? I don't even mention
> anything related to AX anywhere in my app. I must confess I have never
> even read the accessibility section of the docs and don't know what it
> is.
>
>> From the stack trace it appears that the exception occurs even before
> any of my own code is entered,  somewhere in system frameworks.
>
> And it happens only on selected Macs.
>
> Do you have any idea?
>
> Thanks.
>
> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
>> Oleg,
>>
>> I think you are misinterpreting an exception being raised as a crash of
>> your application. The bt's below are not crashes; they are exceptions 
>> being
>> raised (and caught) by appkit's accessibility.
>>
>> I understand that you have a problem with your app crashing -- do you
>> have some actual crash reports? If so, reply with those to the list and 
>> we
>> may be able to help you.
>>
>> -corbin
>>
>> On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>>
>>> Hi,
>>>
>>> After publishing an update of my app, I have received quite a few
>>> crash dumps with very weird stack traces that I cannot understand and
>>> fix.
>>>
>>> Namely, the exception message says that AXTitle, or AXWindow or
>>> AXValue or AXDocument etc. is unsupported by NSWindow, NSOpenPanel,
>>> NSApplication and others. Does it have something to do with
>>> accessibility? In what way?
>>>
>>> If someone knows what's that supposed to mean,

Re: Custom Field Editor Problem

2010-02-02 Thread Ross Carter
On Feb 2, 2010, at 2:02 PM, John Nairn wrote:

> I copied code from Cocoa documentation to create a custom field editor. It 
> gets created OK and seems to work, but always crashes when the the window 
> closes with the message
> 
> Program received signal:  “EXC_BAD_ACCESS”.
> sharedlibrary apply-load-rules all
> 
> I created the custom editor in the window controller using code from Apple:
> 
> - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject
> { 
>if([anObject isKindOfClass:[NSTextField class]])
>{  if(!customEditor)
>   {   customEditor=[[BrowserFieldEditor alloc] init];
>   [customEditor setFieldEditor:YES];
>   }
>   return customEditor;
>}
>return nil;
> }
> 
> When the window controller is deallocated, it calls
> 
> [customEditor dealloc];
> 
> Finally, the entire custom editor, which is NSTextView subclass, is
> 
> @implementation BrowserFieldEditor
> 
> - (id)init
> {   if(self=[super init])
>{   NSLog(@"init field editor");
>}
>return self;
> }
> 
> - (void)dealloc
> {NSLog(@"dealloc field editor");
>[super dealloc];
> }
> 
> @end
> 
> The "init field editor" message appears when created and the "dealloc field 
> editor" appears just before the crash.  If I change the window controller to 
> not release the custom editor, the crash stops, but the "dealloc field 
> editor" message never appears (i.e., a memory leak). Also the Apple 
> documentation explicitly says:
> 
> The custom field editor should be released in an appropriate place, such as 
> the dealloc method of the window delegate object (if the field editor was 
> never instantiated, therelease message has no effect and is harmless).

Well, the first thing I notice is [customEditor dealloc];. Do you mean 
release?___

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

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


Re: Analyzer Questions

2010-02-02 Thread Wade Tregaskis
> - (CGPDFDocumentRef)getPDFDocumentRef:(const char *)filename { 
>   CGPDFDocumentRefdocument; 
> 
>snip...
> 
>   document = CGPDFDocumentCreateWithURL(url); 
>   return document; 
> } 

The CF convention is that functions and methods that return a literal reference 
to an object - that is, the caller doesn't receive ownership of it - use the 
verb "get", as you have above.  Functions and methods which do return ownership 
use the "copy" or "create" verbs.

Clang Static Analyzer uses these cues to decide what it thinks you should be 
doing.  If you rename your above method to createPDFDocumentRef:, you should 
find it's a lot less confused.

Wade
___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Oleg Krupnov
Good point, Jesper.

But in this case, how should I catch real unhandled exceptions and
send bug reports? What is the recommended best practice?

Thanks!

On Tue, Feb 2, 2010 at 10:22 PM, Jesper Storm Bache  wrote:
> My advice is: Don't do this in release builds. There is nothing that says 
> that Apple in the future will throw more exceptions inside their 
> implementation (in a different framework) - and you'll then have to patch 
> your handler again.
> Feel free to experiment with this kind of functionality in your debug builds.
> Alternatively have a "Debug level" preference that you can have users turn on 
> (and off). Make the default "Off".
>
> Jesper
>
> On Feb 2, 2010, at 12:18 PM, Oleg Krupnov wrote:
>
>> Fixed now, it worked like a charm! :)
>>
>> Indeed, I was intercepting exceptions from the AX framework in my -
>> (BOOL)exceptionHandler:(NSExceptionHandler*)sender
>> shouldHandleException:(NSException*)exception mask:(unsigned int)mask
>> delegate method. This only occurs on Snow Leopard but not on Leopard.
>> I was able to reproduce the bug using the Accessibility Inspector
>> utility. And I have fixed it as advised.
>>
>> Thanks a ton to everybody who responded!!!
>>
>>
>> On Tue, Feb 2, 2010 at 9:09 PM, Jesper Storm Bache  wrote:
>>> Are you sure you are seeing "unhandled exceptions", or simply 
>>> "NSExceptions" that are handled somewhere inside the Ax framework.
>>> If it is the latter, then you'll need to allow NSExceptions from inside the 
>>> Ax framework to propagate to their handlers (also inside the Ax framework).
>>> Note: Apple does *not* guarantee that their implementation is NSException 
>>> free; you just should not see such exceptions being thrown back to your 
>>> code.
>>>
>>> For this reason I only enable NSException detection logic in my debug 
>>> builds, and the current version of my debug handler is:
>>>
>>> void ExceptionCallback(id exceptionObject)
>>> {
>>>       bool doBreak = true;
>>>       if ([exceptionObject isKindOfClass:[NSException class]])
>>>       {
>>>               NSString* name = [exceptionObject name];
>>>
>>>               // Ignore exceptions from the accessibility framework because 
>>> it uses
>>>               // exceptions for flow control
>>>               doBreak = ![name isEqualToString:NSAccessibilityException];
>>>       }
>>>
>>>       if (doBreak)
>>>       {
>>>               report_problem(...)
>>>       }
>>> }
>>>
>>> Jesper Storm Bache
>>>
>>> On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:
>>>
 Thanks Ken,

 I don't quite understand your response though. What do you mean by
 "unexceptional exceptions"? How should I handle those exceptions, and
 why should I, if I don't make any calls to accessibility frameworks at
 all?

 The report I have included in the first post is all I have so far.



 On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
> Hi Oleg,
> Unfortunately, the accessibility mechanism uses unexceptional exceptions
> under the hood.  These are a normal part of operation.  They shouldn't be
> unhandled though… are you sure you're reporting what you think you are?
> -Ken
> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  
> wrote:
>>
>> Hi Corbin,
>>
>> Thanks for your quick response. You are right, I should have been more
>> specific. This is not a "crash" in precise meaning. This is an
>> unhandled exception raised by appkit's accessibility and caught by my
>> crash reporter facility that prints the stack trace and sends it to me
>> by e-mail. There is no real, severe crash like that one when you see
>> the Apple's crash report dialog.
>>
>> The question is -- why this exception is raised? I don't even mention
>> anything related to AX anywhere in my app. I must confess I have never
>> even read the accessibility section of the docs and don't know what it
>> is.
>>
>>> From the stack trace it appears that the exception occurs even before
>> any of my own code is entered,  somewhere in system frameworks.
>>
>> And it happens only on selected Macs.
>>
>> Do you have any idea?
>>
>> Thanks.
>>
>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
>>> Oleg,
>>>
>>> I think you are misinterpreting an exception being raised as a crash of
>>> your application. The bt's below are not crashes; they are exceptions 
>>> being
>>> raised (and caught) by appkit's accessibility.
>>>
>>> I understand that you have a problem with your app crashing -- do you
>>> have some actual crash reports? If so, reply with those to the list and 
>>> we
>>> may be able to help you.
>>>
>>> -corbin
>>>
>>> On Feb 2, 2010, at 10:04 AM, Oleg Krupnov wrote:
>>>
 Hi,

 After publishing an update of my app, I have received quite a few
 crash dumps with very weird stack traces that I canno

Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Corbin Dunn

On Feb 2, 2010, at 12:41 PM, Oleg Krupnov wrote:

> Good point, Jesper.
> 
> But in this case, how should I catch real unhandled exceptions and
> send bug reports? What is the recommended best practice?
> 

NSSetUncaughtExceptionHandler possibly. I haven't had to use it myself...

--corbin


___

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

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


Re: Analyzer Questions

2010-02-02 Thread Bob Barnes
David,

   Thanks, changing several methods to use the 'new..." naming standard did the 
trick. Using create as suggested by Wade didn't fix the problem, which explains 
why another method (createBitmapContext) was showing similar behavior. 

Bob


On Feb 2, 2010, at 12:18 PM, David Duncan wrote:

> On Feb 2, 2010, at 11:58 AM, Bob Barnes wrote:
> 
>>  I've recently upgraded to Mac OS X 10.6.2 in order to run the Analyzer for 
>> Xcode and it's pointing out some potential memory leaks that really have me 
>> confused. A typical example is where I have a method that allocates and 
>> returns something like a CGPDFDocumentRef or CGContextRef. The analyzer 
>> reports that  the object allocated and stored in the variable is potentially 
>> being leaked, however, if I call the appropriate release, such as 
>> CGPDFDocumentRelease or CGContextRelease in the calling method it's reported 
>> as an incorrect decrement of an object not owned by the caller. 
> 
> 
> The analyzer checks the standard Cocoa/CF ownership model. In short it is 
> reporting that a "getter" method (that returns a non-owned instance) is 
> returning an owned instance, which it believes may be a memory leak (because 
> the caller is not expected to release the object). Similarly it is reporting 
> that a method is releasing an object that it does not own (because the method 
> used a "getter" to get the object).
> 
> Basically, your code doesn't conform to the standard ownership model, which 
> is confusing the analyzer. If you renamed your method to "newPDFDocumentRef" 
> then the analyzer wouldn't give you either error, as this would be in line 
> with the standard ownership model.
> --
> David Duncan
> Apple DTS Animation and Printing
> 

___

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

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


Re: Analyzer Questions

2010-02-02 Thread David Duncan
On Feb 2, 2010, at 1:14 PM, Bob Barnes wrote:

>   Thanks, changing several methods to use the 'new..." naming standard did 
> the trick. Using create as suggested by Wade didn't fix the problem, which 
> explains why another method (createBitmapContext) was showing similar 
> behavior. 


Create only works with functions (CF convention). new only works with methods 
(Cocoa convention).
--
David Duncan
Apple DTS Animation and Printing

___

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

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


Re: Showing a menu after a delay...?

2010-02-02 Thread Graham Cox

On 03/02/2010, at 2:12 AM, Eric Gorr wrote:

> This method is generally not overridden



> I have filed a bug requesting that trackMouse:inRect:ofView:untilMouseUp: 
> call continueTracking:at:inView: and stopTracking:at:inView:mouseIsUp: ... or 
> is there a reason why it shouldn't?


Note that it says is GENERALLY not overridden, not that it is NEVER overridden.

I've noticed that quite a few built-in cell classes override at this level, 
where others override the more fine-grained methods. I guess it's just a 
question of what makes the most sense or is easiest for a given implementation. 
NSButtonCell does call -startTrackingAt:inView:, but not the others, I think. 
It appears to run a modal loop within -startTrackingAt:...

I've only written one or two custom cell classes but have overridden at both 
levels. I did find that for 'button-like' tracking behaviour, overriding 
-trackMouse:... or -startTrackingAt:... was simplest, because you can keep 
control in an event-fetching loop until the mouse goes up before returning. For 
many controls, that's way easier than dealing with three other methods called 
at different times.

Back to your original question, you want to show a menu after a delay. I do 
this in a custom button cell (subclass of NSButtonCell). Here's my code FWIW, 
which unfortunately is a bit hackish. I don't bother cancelling the timer on 
mouse up, but I decide whether to actually show the menu based on whether the 
cell is still highlighted at the time, otherwise the timer callback does 
nothing. I also found it necessary to "fake up" a mouse up event when the menu 
tracking has completed to ensure the cell tracking is forced to return, because 
otherwise the pop-up menu tracking has swallowed the mouse-up event and so the 
button would otherwise remain stuck in its tracking loop waiting for a mouse-up 
that will never arrive. There may well be a far less hackish way to do that, 
but this does work:

(I note that KBPopUpToolbarItem doesn't do something similar because it 
implements its own tracking loop in its entirety, so has full control over when 
it returns. My code relies on inheriting more of NSButtonCell's standard 
behaviour, so the mouse-up event was needed.)



- (BOOL)startTrackingAt:(NSPoint) startPoint inView:(NSView*) 
controlView
{
// if there is a menu and show after delay is YES, start a timer for 
showing the menu

if([self menu] && [self showsMenuAfterDelay] && mMenuTimer == nil)
{
mMenuTimer = [[NSTimer timerWithTimeInterval:[self menuDelay] 
target:self selector:@selector(menuDelayCallback:) userInfo:nil repeats:NO] 
retain];  

[[NSRunLoop currentRunLoop] addTimer:mMenuTimer 
forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mMenuTimer 
forMode:NSDefaultRunLoopMode];

// make a note of the mouse location for faking the mouse-up at 
the end:

mMouseDownPoint = [controlView convertPoint:startPoint 
toView:nil];
}

return [super startTrackingAt:startPoint inView:controlView];
}


- (void)menuDelayCallback:(NSTimer*) timer
{
#pragma unused(timer)

// show the cell's menu if the button is still highlighted (if user let 
go, it won't be)

if([self isHighlighted])
{
// pop up the menu and switch tracking to it.

NSMenu* menu = [self menu];
NSEvent* event = [NSApp currentEvent];

// menu tracking keeps control until a choice is made:

[NSMenu popUpContextMenu:menu withEvent:event forView:[self 
controlView]];

// on return, post a mouse-up so that the cell tracking 
completes as normal. The mouse location
// was recorded at the time it went down and the callback was 
scheduled

NSWindow* window = [[self controlView] window];

NSEvent* fakeMouseUp = [NSEvent mouseEventWithType:NSLeftMouseUp
location:mMouseDownPoint
modifierFlags:0
timestamp:[NSDate 
timeIntervalSinceReferenceDate]
windowNumber:[window 
windowNumber]

context:[NSGraphicsContext currentContext]
eventNumber:0
clickCount:1
pressure:0.0];

[window postEvent:fakeMouseUp atStart:YES];

// after a menu selection, ensure the button is set to its ON 
state:


Re: Custom Field Editor Problem

2010-02-02 Thread Corbin Dunn
John, I suggest reading:

http://www.corbinstreehouse.com/blog/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/

--corbin

On Feb 2, 2010, at 11:02 AM, John Nairn wrote:

> I copied code from Cocoa documentation to create a custom field editor. It 
> gets created OK and seems to work, but always crashes when the the window 
> closes with the message
> 
> Program received signal:  “EXC_BAD_ACCESS”.
> sharedlibrary apply-load-rules all
> 
> I created the custom editor in the window controller using code from Apple:
> 
> - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject
> { 
>if([anObject isKindOfClass:[NSTextField class]])
>{  if(!customEditor)
>   {   customEditor=[[BrowserFieldEditor alloc] init];
>   [customEditor setFieldEditor:YES];
>   }
>   return customEditor;
>}
>return nil;
> }
> 
> When the window controller is deallocated, it calls
> 
> [customEditor dealloc];
> 
> Finally, the entire custom editor, which is NSTextView subclass, is
> 
> @implementation BrowserFieldEditor
> 
> - (id)init
> {   if(self=[super init])
>{   NSLog(@"init field editor");
>}
>return self;
> }
> 
> - (void)dealloc
> {NSLog(@"dealloc field editor");
>[super dealloc];
> }
> 
> @end
> 
> The "init field editor" message appears when created and the "dealloc field 
> editor" appears just before the crash.  If I change the window controller to 
> not release the custom editor, the crash stops, but the "dealloc field 
> editor" message never appears (i.e., a memory leak). Also the Apple 
> documentation explicitly says:
> 
> The custom field editor should be released in an appropriate place, such as 
> the dealloc method of the window delegate object (if the field editor was 
> never instantiated, therelease message has no effect and is harmless).
> 

___

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

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


Re: Analyzer Questions

2010-02-02 Thread Jean-Daniel Dupas
If for some reason you really want to use a naming convention that confuses the 
analyzer, you can also use the ns_returns_retained and cf_returns_retained 
clang attributes.

For details about these attributes (how to use them in a way that do not 
conflict with GCC), have a look at the following link:

http://clang-analyzer.llvm.org/annotations.html

Hopefully, new annotations will be added to the list so we can write our own 
retain/release wrapper without having lot of false positive.


Le 2 févr. 2010 à 22:14, Bob Barnes a écrit :

> David,
> 
>   Thanks, changing several methods to use the 'new..." naming standard did 
> the trick. Using create as suggested by Wade didn't fix the problem, which 
> explains why another method (createBitmapContext) was showing similar 
> behavior. 
> 
> Bob
> 
> 
> On Feb 2, 2010, at 12:18 PM, David Duncan wrote:
> 
>> On Feb 2, 2010, at 11:58 AM, Bob Barnes wrote:
>> 
>>> I've recently upgraded to Mac OS X 10.6.2 in order to run the Analyzer for 
>>> Xcode and it's pointing out some potential memory leaks that really have me 
>>> confused. A typical example is where I have a method that allocates and 
>>> returns something like a CGPDFDocumentRef or CGContextRef. The analyzer 
>>> reports that  the object allocated and stored in the variable is 
>>> potentially being leaked, however, if I call the appropriate release, such 
>>> as CGPDFDocumentRelease or CGContextRelease in the calling method it's 
>>> reported as an incorrect decrement of an object not owned by the caller. 
>> 
>> 
>> The analyzer checks the standard Cocoa/CF ownership model. In short it is 
>> reporting that a "getter" method (that returns a non-owned instance) is 
>> returning an owned instance, which it believes may be a memory leak (because 
>> the caller is not expected to release the object). Similarly it is reporting 
>> that a method is releasing an object that it does not own (because the 
>> method used a "getter" to get the object).
>> 
>> Basically, your code doesn't conform to the standard ownership model, which 
>> is confusing the analyzer. If you renamed your method to "newPDFDocumentRef" 
>> then the analyzer wouldn't give you either error, as this would be in line 
>> with the standard ownership model.
>> --
>> David Duncan
>> Apple DTS Animation and Printing
>> 
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org
> 
> This email sent to devli...@shadowlab.org
> 

-- Jean-Daniel




___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Jesper Storm Bache
Did you try:
NSException.h:
void NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *);

Be aware that I don't have any experience with this API - my implementation has 
top level exception handlers in relevant places, so I should never see an 
uncaught exception.

Jesper

On Feb 2, 2010, at 12:41 PM, Oleg Krupnov wrote:

> Good point, Jesper.
>
> But in this case, how should I catch real unhandled exceptions and
> send bug reports? What is the recommended best practice?
>
> Thanks!
>
> On Tue, Feb 2, 2010 at 10:22 PM, Jesper Storm Bache  wrote:
>> My advice is: Don't do this in release builds. There is nothing that says 
>> that Apple in the future will throw more exceptions inside their 
>> implementation (in a different framework) - and you'll then have to patch 
>> your handler again.
>> Feel free to experiment with this kind of functionality in your debug builds.
>> Alternatively have a "Debug level" preference that you can have users turn 
>> on (and off). Make the default "Off".
>>
>> Jesper
>>
>> On Feb 2, 2010, at 12:18 PM, Oleg Krupnov wrote:
>>
>>> Fixed now, it worked like a charm! :)
>>>
>>> Indeed, I was intercepting exceptions from the AX framework in my -
>>> (BOOL)exceptionHandler:(NSExceptionHandler*)sender
>>> shouldHandleException:(NSException*)exception mask:(unsigned int)mask
>>> delegate method. This only occurs on Snow Leopard but not on Leopard.
>>> I was able to reproduce the bug using the Accessibility Inspector
>>> utility. And I have fixed it as advised.
>>>
>>> Thanks a ton to everybody who responded!!!
>>>
>>>
>>> On Tue, Feb 2, 2010 at 9:09 PM, Jesper Storm Bache  
>>> wrote:
 Are you sure you are seeing "unhandled exceptions", or simply 
 "NSExceptions" that are handled somewhere inside the Ax framework.
 If it is the latter, then you'll need to allow NSExceptions from inside 
 the Ax framework to propagate to their handlers (also inside the Ax 
 framework).
 Note: Apple does *not* guarantee that their implementation is NSException 
 free; you just should not see such exceptions being thrown back to your 
 code.

 For this reason I only enable NSException detection logic in my debug 
 builds, and the current version of my debug handler is:

 void ExceptionCallback(id exceptionObject)
 {
  bool doBreak = true;
  if ([exceptionObject isKindOfClass:[NSException class]])
  {
  NSString* name = [exceptionObject name];

  // Ignore exceptions from the accessibility framework because 
 it uses
  // exceptions for flow control
  doBreak = ![name isEqualToString:NSAccessibilityException];
  }

  if (doBreak)
  {
  report_problem(...)
  }
 }

 Jesper Storm Bache

 On Feb 2, 2010, at 10:58 AM, Oleg Krupnov wrote:

> Thanks Ken,
>
> I don't quite understand your response though. What do you mean by
> "unexceptional exceptions"? How should I handle those exceptions, and
> why should I, if I don't make any calls to accessibility frameworks at
> all?
>
> The report I have included in the first post is all I have so far.
>
>
>
> On Tue, Feb 2, 2010 at 8:51 PM, Ken Ferry  wrote:
>> Hi Oleg,
>> Unfortunately, the accessibility mechanism uses unexceptional exceptions
>> under the hood.  These are a normal part of operation.  They shouldn't be
>> unhandled though… are you sure you're reporting what you think you are?
>> -Ken
>> On Tue, Feb 2, 2010 at 6:41 PM, Oleg Krupnov  
>> wrote:
>>>
>>> Hi Corbin,
>>>
>>> Thanks for your quick response. You are right, I should have been more
>>> specific. This is not a "crash" in precise meaning. This is an
>>> unhandled exception raised by appkit's accessibility and caught by my
>>> crash reporter facility that prints the stack trace and sends it to me
>>> by e-mail. There is no real, severe crash like that one when you see
>>> the Apple's crash report dialog.
>>>
>>> The question is -- why this exception is raised? I don't even mention
>>> anything related to AX anywhere in my app. I must confess I have never
>>> even read the accessibility section of the docs and don't know what it
>>> is.
>>>
 From the stack trace it appears that the exception occurs even before
>>> any of my own code is entered,  somewhere in system frameworks.
>>>
>>> And it happens only on selected Macs.
>>>
>>> Do you have any idea?
>>>
>>> Thanks.
>>>
>>> On Tue, Feb 2, 2010 at 8:34 PM, Corbin Dunn  wrote:
 Oleg,

 I think you are misinterpreting an exception being raised as a crash of
 your application. The bt's below are not crashes; they are exceptions 
 being
 raised (and caught) by appkit's accessibility.

Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Kyle Sluder
On Tue, Feb 2, 2010 at 2:28 PM, Jesper Storm Bache  wrote:
> Did you try:
> NSException.h:
>        void NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *);

I might be missing something here, but why would this be usable and
NSExceptionHandler not? NSExceptionHandler is documented to work by
installing an uncaught exception handler using this function.

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

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


NSCollectionView and its Items

2010-02-02 Thread Joachim Deelen
Hi,

is it possible, in Mac OS X 10.5, to get a list of the NSCollectionViewItems 
directly from the NSCollectionView. The "content" Message returns a list of the 
Represented-Objects, not the Items.

Currently I'm overwriting the "newItemForRepresentedObject". Within that method 
I'm putting the created items in an internal Array for later use. While 
debugging my App, under 10.6, I saw that NSCollectionView has a "_content" 
attribute which holds all the NSCollectionViewItems. But calling "content" on 
the CollectionView returns the Represented-Objects not the ViewItems.

I know in 10.6 there is a new method "itemAtIndex" which returns the ViewItem 
but since my App has to be 10.5 compatible I can not use it.

I can live with the workaround of overwriting "newItemForRepresentedObject" but 
to me it seems unnecessary because the CollectionView already has all the 
information.

Any Ideas?

-
Joachim



___

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

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


CoreAnimation "breaks" when switching from NSView to NSBox

2010-02-02 Thread Mark Sanvitale
"Breaks" is a subjective description (thus the quotes) for what I experienced, 
but from my perspective it is accurate.  Here's what happened.  I had a custom 
subclass of NSView and I setup it up (in code) to be layer-backed with a 
CATransition for the "subviews" key (i.e. fade in/out animation for changes to 
the subviews).  All is well.

Changed this custom subclass to descend from NSBox (instead of NSView) so I 
could take advantage of the selection-highlighting-within-a-Collection-View 
trick demonstrated in the "IconCollection" (Apple-provided) sample project 
(take an NSBox with a fill color and bind its transparent property to the 
"selected" property of its associated NSCollectionViewItem).

A day or so later I notice that my fade in/out animation is gone.  Eventually 
track this regression down to the change from NSView-subclass to NSBox-subclass.

Should I be surprised by this difference in behavior between NSView and NSBox?  
I have been setting up my animation via:

[self setWantsLayer:YES];
[self setAnimations:[NSDictionary dictionaryWithObject:transition 
forKey:@"subviews"]];

and then expecting animation to occur when executing this:

[[self animator] replaceSubview:mThumbnailStandin with:mThumbnail];

perhaps there is some other way to install/provide my animation that NSBox will 
respect?

Any ideas?  I realize there is the straightforward approach of staying with an 
NSView sub-class and doing my own binding-friendly fill color.

Thanks in advance.

Mark Sanvitale

___

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

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


Re: Analyzer Questions

2010-02-02 Thread Wade Tregaskis
>>  Thanks, changing several methods to use the 'new..." naming standard did 
>> the trick. Using create as suggested by Wade didn't fix the problem, which 
>> explains why another method (createBitmapContext) was showing similar 
>> behavior. 
> 
> Create only works with functions (CF convention). new only works with methods 
> (Cocoa convention).

My apologies, I was extrapolating from 'copy', which is supported in both.

Tangentially, I find it odd that 'new' is recognised as it puts me in mind of 
the old 'new' class method, which has been deprecated and frowned upon for as 
long as I can remember.

Wade
___

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

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


Re: Opening dual NSStreams synchronously

2010-02-02 Thread Jens Alfke


On Feb 2, 2010, at 11:27 AM, Richard Penwell wrote:

Very true on the overall method, I'd prefer to make the whole thing  
asynchronous, but thus far cannot figure out how to wrangle  
SenTestKit into handling test methods that pass when a delegate  
method is called...


I've done this in the past by writing a test utility method that spins  
the runloop until a flag is set or a timeout occurs. The delegate  
method then sets the flag. It's sort of like what you're doing now,  
except that the synchronous stuff is in the test code, not in the  
actual library.


—Jens___

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

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


Re: RegisterEventHotKey and keylogging

2010-02-02 Thread Michael Vannorsdel
Ya makes sense and pretty much what I saw; input was getting absorbed  
by the hotkey app.  I'm just thinking if a userland processed hotkeyed  
all keys when the pass window popped.  I'm guilty of quickly typing my  
pass so I could get 3-4 characters into it before I'd notice input  
isn't working, and other users might type the whole thing a few times  
tying to get it to work.  I'm just wondering if there's built-in  
protection against this scenario or just something users have to know  
about and watch for.



On Feb 2, 2010, at 3:15 AM, Symadept wrote:


Hi Michael,

Basically RegisterEventHotKey registers given combination of hotkey  
identified with the keycode. If it happens to be your pressing key  
is registered as hotkey then you wont be able to see that. Lets say  
you have registered A as hotkey in some application then either in  
your password or username field you can never be able to print A and  
inturn fires hotkey which may be the response of that particular app.


Hope it is clear to you.=

___

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

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


Re: HELP! My app crashes on startup, with a very weird stack trace.

2010-02-02 Thread Jesper Storm Bache
I doubt you are missing something & you may be right that maybe 
NSExceptionHandler can be used (with the right mask).
The only real input I have on this matter is that I consider it fragile to fail 
if an Apple framework throws an exception internally.
You'll need to be able to detect exceptions are "thrown *and* not caught" by 
the frameworks.

I have not need to do this, and I can therefore not offer a solution that I 
know works.

Jesper

On Feb 2, 2010, at 2:37 PM, Kyle Sluder wrote:

> On Tue, Feb 2, 2010 at 2:28 PM, Jesper Storm Bache  wrote:
>> Did you try:
>> NSException.h:
>>void NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *);
> 
> I might be missing something here, but why would this be usable and
> NSExceptionHandler not? NSExceptionHandler is documented to work by
> installing an uncaught exception handler using this function.
> 
> --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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?

2010-02-02 Thread Keary Suska
On Feb 2, 2010, at 1:20 PM, Quincey Morris wrote:

> 1. There are three (3) [III] agents involved in a binding.
> 
> -- Class A (typically some kind of view) defines+implements a binding 
> [behavior] identified by an attribute "x". "Attribute" is not the best choice 
> of terminology, but it's what the documentation uses. It's basically an 
> arbitrary string with a meaning that's internal to A, though sometimes it 
> happens to be a KVC property name too. The attribute may or may not be 
> "exposed" to IB as a "binding name".
> 
> -- Class B (typically a data model object) defines+implements a KVC property 
> "y".
> 
> -- Class C (typically some kind of controller) is responsible for hooking 
> things up. If the binding is set up in IB, C's behavior is somewhere inside 
> the nib-loading code. If the binding is established programmatically, C is an 
> application-defined class.
> 
> 2. An object c of class C establishes a binding [link] from attribute "x" of 
> an object a of class A to property "y" of an object b of class, by sending 
> this message:
> 
>   [a bind: @"x" toObject: b withKeyPath: @"y" options: ...];

This is not usually the case. Object c will usually emit:

[a bind: @"x" toObject: c withKeyPath: @"z" options: ...];

Where "z" is a property of c or a key path "z.y" as controllers typically 
"control" one model (b). If you write the controller you could certainly bind 
directly as you show, but then you have to unbind/rebind any time your model 
object changes (to a different object), or you have to wait until the model 
object exists before binding. Not a very extensible design.

> Note that A, B and C are *not* necessarily distinct. Often A == C and a == c:
> 
>   [self bind: @"x" toObject: b withKeyPath: @"y" options: ...];
> 
> In terms of establishing a binding [link], that's the whole story. C does not 
> care what the implementation of 'bind:...' is -- that's an implementation 
> detail inside A. All C cares about is that sending this message causes the 
> binding [link] to exist.
> 
> Certainly C knows that 'bind:...' must set up some machinery to make A's 
> binding [behavior] work, but it's a mistake to think that this machinery *is* 
> the binding [behavior]. That's where the discussion usually goes off the 
> rails. The train wreck is made more likely because:
> 
> -- there's no proper terminology to distinguish a binding [link] from a 
> binding [behavior]
> 
> -- NSObject's implementation of 'bind:...' happens to do something that's 
> sort of useful in isolation, if class A doesn't actually define binding "x' 
> but has a KVC property "x"

I don't believe this is true--it is simply the default behavior of NSObject (se 
also below) when "A" has KVC property "x". The one bind call is sufficient for 
the entire binding behavior to function, as long as every key along the bound 
key path is KVO compliant. Nothing additional is required. There is 
documentation about cleaning up bindings, but I think even that is done 
automatically for conforming properties.

> It'd be better for everyone, I think, if NSObject had no implementation of 
> 'bind:...' at all, or if its implementation was moved to a convenience method 
> that didn't mention the word "binding".
> 
> 3. Class A is responsible for providing the binding [behavior]. This consists 
> of three parts:
> 
> -- An implementation of NSKeyValueBindingProtocol. Most significantly, an 
> implementation of the 'bind:...' method.
> 
> -- Detection of changes in the bound-to property ("y" in class B, above), and 
> synchronization of its "x" attribute to such changes.

Yes, except for the "z"/"z.y" clarifications above.

> -- Propagation of changes to its "x" attribute to the bound-to property.
> 
> It can do this any way it wants. Really. An outside agent (class C) can 
> assume *nothing* about the implementation of an arbitrary binding in A, 
> beyond conformance to the protocol. The implementation may or may not use 
> KVO. The implementation may or may not use NSObject's 'bind:...'.

Well, C *can* assume that if it emits a KVO notice of a bound property that it 
has fulfilled its part of the bargain. This is a documented necessity--all 
bound objects along the key path must be KVO compliant. Whether or not "A" does 
anything about it is another matter. "A" could be broken.

> If you follow along with the documentation, part 3 is always custom code. 
> Part 2 is most naturally done with KVO, and set up in the 'bind:...' method. 
> Class A might provide its own implementation of that method, or it might 
> leverage the NSObject implementation.

No, NSObject has a default implementation for part 3. You don't need to code 
anything. You *could*, but you don't have to as long as your follow KVO rules. 
I don't think this is an accident--it is by design. In the same way that an 
accessor is not necessarily an ivar, a binding name is not necessarily a named 
property in any official sense, but that doesn't define its b

Cloning an NSXMLElement and its children?

2010-02-02 Thread Robert Monaghan
Hi Everyone..

Is there an easy way to clone an XML tree in Cocoa? Or will I be going thru 
recursion code hell?
:)


Thanks!

bob.

___

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

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


Re: Cloning an NSXMLElement and its children?

2010-02-02 Thread Jens Alfke


On Feb 2, 2010, at 4:16 PM, Robert Monaghan wrote:

Is there an easy way to clone an XML tree in Cocoa? Or will I be  
going thru recursion code hell?


Did you try -copy? NSXMLNode implements NSCopying. The only question  
is whether it's a deep or a shallow copy.


—Jens___

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

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


Re: Cloning an NSXMLElement and its children?

2010-02-02 Thread Robert Monaghan
Its a fairly deep copy. There are several nodes deep.
I am trying to copy parts of the tree, so that I don't have to write code to 
regenerate them.

bob.

On Feb 2, 2010, at 4:26 PM, Jens Alfke wrote:

> 
> On Feb 2, 2010, at 4:16 PM, Robert Monaghan wrote:
> 
>> Is there an easy way to clone an XML tree in Cocoa? Or will I be going thru 
>> recursion code hell?
> 
> Did you try -copy? NSXMLNode implements NSCopying. The only question is 
> whether it's a deep or a shallow copy.
> 
> —Jens

___

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

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


Re: Cloning an NSXMLElement and its children?

2010-02-02 Thread Robert Monaghan
Actually, I was able to use copyWithZone to do what I needed.
Nice!

bob.

On Feb 2, 2010, at 4:28 PM, Robert Monaghan wrote:

> Its a fairly deep copy. There are several nodes deep.
> I am trying to copy parts of the tree, so that I don't have to write code to 
> regenerate them.
> 
> bob.
> 
> On Feb 2, 2010, at 4:26 PM, Jens Alfke wrote:
> 
>> 
>> On Feb 2, 2010, at 4:16 PM, Robert Monaghan wrote:
>> 
>>> Is there an easy way to clone an XML tree in Cocoa? Or will I be going thru 
>>> recursion code hell?
>> 
>> Did you try -copy? NSXMLNode implements NSCopying. The only question is 
>> whether it's a deep or a shallow copy.
>> 
>> —Jens
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/bob%40gluetools.com
> 
> This email sent to b...@gluetools.com

___

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

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


Re: Core Data - Need an Observer but where and how to implement

2010-02-02 Thread Jerry Krinock

On 2010 Feb 02, at 11:54, Andreas Grauel wrote:

> I have two Entities - Person and Event - both are with
> a many to many relationship, because a person can have more events and a
> event can have more persons. After I have added a few Persons to an Event
> I'd like to display them on in a Table. But how? I tried a Binding with
> Events - selection - person.firstName but then always comes this Error.
> 
> 2010-02-02 20:37:39.948 Kegeln[4128:a0f] [<_NSFaultingMutableSet
> 0x100227180> addObserver:forKeyPath:options:context:] is not supported. Key
> path: firstName

Classic problem.  You can't bind through a to-many key path.

> I also have tried some other things but cannot figure it out. I have also
> tried to add an Observer but wasn't able to. I have tried to add an Observer
> to the EventArrayController, but didn't work or maybe i did it wrong. What
> can i do? Please help.

This looks like exactly the same question I asked about two and a half years 
ago.  Probably 75% of what I said was wrong, but if you discount my profanities 
and concentrate on the responses from mmalc and others, you should get a proper 
start on this.

http://www.cocoabuilder.com/archive/cocoa/189290-managed-object-wants-per-relationship-attribute.html#189292

In particular, disregard my advice in the final Oct 03 message to use 
NSManagedObjectContextObjectsDidChangeNotification.  I have since learned that 
NSManagedObjectContextObjectsDidChangeNotification fails to provide what is 
needed to make a real app which updates dependent properties, supports undo, 
etc.

___

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

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


Re: CoreAnimation "breaks" when switching from NSView to NSBox

2010-02-02 Thread Ken Ferry
Hi Mark,

You probably want to set the animations on the box's contentView in addition
to the box itself.

Box forwards modifications to its subviews array to its contentView.
 However, this is something we'd like to get rid of eventually.  It's just a
question of doing it compatibly, having time to evaluate the impact on apps,
etc.

-Ken
Cocoa Frameworks

On Tue, Feb 2, 2010 at 10:56 PM, Mark Sanvitale  wrote:

> "Breaks" is a subjective description (thus the quotes) for what I
> experienced, but from my perspective it is accurate.  Here's what happened.
>  I had a custom subclass of NSView and I setup it up (in code) to be
> layer-backed with a CATransition for the "subviews" key (i.e. fade in/out
> animation for changes to the subviews).  All is well.
>
> Changed this custom subclass to descend from NSBox (instead of NSView) so I
> could take advantage of the selection-highlighting-within-a-Collection-View
> trick demonstrated in the "IconCollection" (Apple-provided) sample project
> (take an NSBox with a fill color and bind its transparent property to the
> "selected" property of its associated NSCollectionViewItem).
>
> A day or so later I notice that my fade in/out animation is gone.
>  Eventually track this regression down to the change from NSView-subclass to
> NSBox-subclass.
>
> Should I be surprised by this difference in behavior between NSView and
> NSBox?  I have been setting up my animation via:
>
>[self setWantsLayer:YES];
>[self setAnimations:[NSDictionary dictionaryWithObject:transition
> forKey:@"subviews"]];
>
> and then expecting animation to occur when executing this:
>
>[[self animator] replaceSubview:mThumbnailStandin with:mThumbnail];
>
> perhaps there is some other way to install/provide my animation that NSBox
> will respect?
>
> Any ideas?  I realize there is the straightforward approach of staying with
> an NSView sub-class and doing my own binding-friendly fill color.
>
> Thanks in advance.
>
> Mark Sanvitale
>
> ___
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

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

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


Re: How to upload a picture or movie existed in the iphone to a given server?

2010-02-02 Thread James
 >And, need I configure server especially  for the app ?

 > What exactly are you trying to accomplish?
 
 
Sorry. thank you for your answer
I want to accomplish an iphone app. 
And the app can upload  picture or movie files in iphone to a given server.
So I want to know  whether it would be difficult.
And what should I do for the aim?
Thank you.
 

 ___

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

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

Re: How to upload a picture or movie existed in the iphone to a given server?

2010-02-02 Thread Scott Ellsworth
2010/2/2 James :
>  >And, need I configure server especially  for the app ?
>
>  > What exactly are you trying to accomplish?
>
>
> Sorry. thank you for your answer
> I want to accomplish an iphone app.

That is rather vague.  What does this app do that the existing apps do
not?  If you cannot answer that question, you may not have a clear
enough problem statement to get help.

> And the app can upload  picture or movie files in iphone to a given server.

Nick's answers work.  You also might have gdata, html form posts, or
other options.

> So I want to know  whether it would be difficult.

Again, depends on what you are trying to do.  Ask first how your app
differs from the presently available apps, and you should have a good
idea as to how hard the app will be.

> And what should I do for the aim?

Depends on your goal.

> Thank you.
>
>
>
> ___
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/scott_ellsworth%40alumni.hmc.edu
>
> This email sent to scott_ellswo...@alumni.hmc.edu
>
___

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

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


NSFont to CGFontRef

2010-02-02 Thread Andy O'Meara
Hi everyone,

Given an NSFont object how can I extract or create a CGFontRef from it to use 
directly with CoreGraphics?

I've already searched around in the lists and ADC with no luck.  

So far, I've tried the following:

NSFontManager* fm = [NSFontManager sharedFontManager];
NSFont* font = [ fm fontWithFamily:... ];

CFDictionaryRef dict = CFDictionaryCreate( kCFAllocatorDefault, NULL, 
NULL, 0, NULL, NULL );
CGFontRef fontRef = CGFontCreateCopyWithVariations( (CGFontRef) font, 
dict );
CFRelease( dict );

int unitsPerEM = CGFontGetUnitsPerEm( fontRef );   // CRASH!


Thanks in advance!

Andy___

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

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


keyCode translation for various keyboards

2010-02-02 Thread Dave Carpeneto
Hello list folk - I'm trying to print out strings representing various 
keyDown events I receive. Using OS 10.6.2.


It looks as though this was possible back in the classic days ( 
http://developer.apple.com/legacy/mac/library/documentation/mac/Toolbox/Toolbox-78.html 
), however obviously that doesn't do much for me here.


Obviously the characters / charactersIgnoringModifiers strings I get 
with the event works great for alphanumeric stuff, however I'm also 
interested in things like function keys & the like. And up to this point 
I'm afraid that all I've been able to find on this makes me think I'm 
going to have hard-code a lookup table to translate non-alphanumeric key 
presses, which has me freaked out, since I've no idea what keyboards are 
like in other locales.


So far the two approaches I've seen are as follows:

Approach #1: Map every keyCode you can think of (example: the 
keyStringForKeyCode method in 
http://ritter.ist.psu.edu/projects/RUI/macosx/rui.c ) :


   switch (keyCode) {
   case 0: return("a");
   case 1: return("s");
   ...
   case 96: return("F5");
   ...

Approach #2: Get what you can via UCKeyTranslate, and then 'fill in the 
blanks' with a lookup table for non-alphanumeric stuff (example: 
http://inquisitivecocoa.com/2009/04/05/key-code-translator , which looks 
like it builds off a patched version of 
http://rogueamoeba.com/sources/HotKeysLib3.zip )


Prior threads by people in the know ( 
http://www.cocoabuilder.com/archive/cocoa/101991-key-codes-and-characters-in-nsevents.html 
) further state that developer-created lookups are a fact of life in 
this area, but I'm reely hoping they are not ...


Questions:

   1) Is there a programmatic method to get strings like this (I'm 
guessing not)


   2) Is a F1 key the same on all keyboards (if so then my worries 
about the lookup table are a non-issue)


   3) Are there any keys typical in other places that don't exist on a 
'standard' North American keyboard ? (if so  heaven help me)


Thanks all for any insight you may be able to provide - Dave




___

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

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


Re: NSFont to CGFontRef

2010-02-02 Thread Nick Zitzmann

On Feb 2, 2010, at 10:26 AM, Andy O'Meara wrote:

> Given an NSFont object how can I extract or create a CGFontRef from it to use 
> directly with CoreGraphics?

You're close. Starting in (I think) Leopard, NSFont and CTFontRef (not 
CGFontRef) are toll-free bridged, so you should be able to use 
CTFontCopyGraphicsFont() to get a CGFontRef from an NSFont.

Nick Zitzmann




___

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

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


Rosetta Quandry

2010-02-02 Thread David Blanton

I run my app on my Intel MacBook Pro.

Get Info shows it as Universal.

I have a customer who must turn Rosetta on else the app crashes.

Is there any rhyme or reason to this?

-db

___

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

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


Re: Binding to an accessor that is only valid for subclass

2010-02-02 Thread BareFeet
Hi All,

>> You can also uncheck the "Raises For Not Applicable Keys" in the bindings 
>> inspector pain in Interface Builder for your text fields.
> 
> Thanks for the tip. Once I read it, it seemed like the logical solution. 
> However, it doesn't seem to make any difference.

After some further investigation, turning off "Raises For Not Applicable Keys" 
does actually work and solves my problem. Hooray! :-)

It wasn't making any difference previously because my model key path was 
something like parsedDictionary.subValue. Even with "Raises For Not Applicable 
Keys" disabled, I still got an error like:

HIToolbox: ignoring exception '[ 
addObserver: 
forKeyPath:@"parsedDictionary.subValue" options:0x100 context:0x0] was sent to 
an object that is not KVC-compliant for the "parsedDictionary" property.' that 
raised inside Carbon event dispatch

So I added a routine to my code for the SubClass:

- (NSString*) subValue
{
return [parsedDictionary objectForKey:@"subValue"];
}

and changed the bindings in IB for the text field to simply have the model key 
path: subValue

Thanks again to John and Jerry for replying.

Thanks,
Tom
BareFeet

 --
Comparison of SQLite GUI tools:
http://www.tandb.com.au/sqlite/compare/?ml

___

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

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


Re: Rosetta Quandry

2010-02-02 Thread Nick Zitzmann

On Feb 2, 2010, at 8:07 PM, David Blanton wrote:

> I run my app on my Intel MacBook Pro.
> 
> Get Info shows it as Universal.
> 
> I have a customer who must turn Rosetta on else the app crashes.
> 
> Is there any rhyme or reason to this?

Assuming you meant to put an "or" between the "on" and "else", did you ask the 
user for the crash log and anything that gets logged to the console at the time 
of the crash?

Nick Zitzmann




___

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

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


Re: Rosetta Quandry

2010-02-02 Thread David Blanton
Yes, I have the crash log that is generated when launching with  
Rosetta off which I include here for list perusal. Interestingly, I  
just got off the phone with an Apple Consulting Engineer who let me  
know that there have been problems (mostly video) with the 27" iMac  
where this problem manifests itself. There have been two firmware  
updates.  we have seen this problem ONLY on 27" iMacs.  Makes ya wonder!


Process: Convert it [160]
Path:/Applications/realConvert it.app/Contents/MacOS/ 
Convert it

Identifier:  com.BriTonLeap.convertitmac
Version: 1.44 (7309)
Code Type:   X86 (Native)
Parent Process:  launchd [98]

Date/Time:   2010-02-01 18:12:24.886 -0600
OS Version:  Mac OS X 10.6.2 (10C2234)
Report Version:  6

Interval Since Last Report:  557183 sec
Crashes Since Last Report:   100
Per-App Interval Since Last Report:  1716 sec
Per-App Crashes Since Last Report:   12
Anonymous UUID:  8481F5B9-3ADA-4E03- 
B92E-3BD0AE4CD4E3


Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib   0x97852732 __kill + 10
1   libSystem.B.dylib   0x97852724 kill$UNIX2003 + 32
2   libSystem.B.dylib   0x978e598d raise + 26
3   libSystem.B.dylib   0x978fba44 abort + 93
4   libstdc++.6.dylib 	0x95628fda  
__gnu_cxx::__verbose_terminate_handler() + 433
5   libstdc++.6.dylib 	0x9562717a  
__cxxabiv1::__terminate(void (*)()) + 10
6   libstdc++.6.dylib 	0x956271ba  
__cxxabiv1::__unexpected(void (*)()) + 0
7   libstdc++.6.dylib 	0x956272b8  
__gxx_exception_cleanup(_Unwind_Reason_Code, _Unwind_Exception*) + 0
8   libstdc++.6.dylib 	0x95627658 operator new(unsigned  
long) + 101
9   libstdc++.6.dylib 	0x95627703 operator new[](unsigned  
long) + 17

10  com.BriTonLeap.convertitmac 0xd79e 0x1000 + 51102
11  com.BriTonLeap.convertitmac   	0x0006be3b  
LinkedList::RemoveAt(__POSITION*) + 1333
12  com.BriTonLeap.convertitmac   	0x0006cc8b  
LinkedList::RemoveAt(__POSITION*) + 4997

13  com.BriTonLeap.convertitmac 0x0002f520 0x1000 + 189728
14  com.BriTonLeap.convertitmac 0x0002fc26 0x1000 + 191526
15  com.BriTonLeap.convertitmac 0x00022e26 0x1000 + 138790
16  com.apple.Foundation0x95bfc270 _nsnote_callback + 345
17  com.apple.CoreFoundation  	0x974f69a9 __CFXNotificationPost +  
905
18  com.apple.CoreFoundation  	0x974f63da  
_CFXNotificationPostNotification + 186
19  com.apple.Foundation  	0x95bf1094 -[NSNotificationCenter  
postNotificationName:object:userInfo:] + 128
20  com.apple.Foundation  	0x95bfe471 -[NSNotificationCenter  
postNotificationName:object:] + 56
21  com.apple.AppKit  	0x9155c73a -[NSApplication  
_postDidFinishNotification] + 125
22  com.apple.AppKit  	0x9155c64a -[NSApplication  
_sendFinishLaunchingNotification] + 74
23  com.apple.AppKit  	0x916b3595 - 
[NSApplication(NSAppleEventHandling) _handleAEOpen:] + 274
24  com.apple.AppKit  	0x916b31b5 - 
[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:]  
+ 101
25  com.apple.Foundation  	0x95c31404 -[NSAppleEventManager  
dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 511
26  com.apple.Foundation  	0x95c311c8  
_NSAppleEventManagerGenericHandler + 228
27  com.apple.AE  	0x9067ff3a  
aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned  
char*) + 166
28  com.apple.AE  	0x9067fe39  
dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 43

29  com.apple.AE0x9067fd46 aeProcessAppleEvent + 197
30  com.apple.HIToolbox 0x96677301 AEProcessAppleEvent + 50
31  com.apple.AppKit0x9152cd02 _DPSNextEvent + 1420
32  com.apple.AppKit  	0x9152c306 -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] + 156

33  com.apple.AppKit0x914ee49f -[NSApplication run] + 821
34  com.apple.AppKit0x914e6535 NSApplicationMain + 574
35  com.BriTonLeap.convertitmac 0x2b92 0x1000 + 7058
36  com.BriTonLeap.convertitmac 0x2ab9 0x1000 + 6841



On Feb 2, 2010, at 8:48 PM, Nick Zitzmann wrote:



On Feb 2, 2010, at 8:07 PM, David Blanton wrote:


I run my app on my Intel MacBook Pro.

Get Info shows it as Universal.

I have a customer who must turn Rosetta on else the app crashes.

Is there any rhyme or reason to this?


Assuming you meant to put an "or" between the "on" and "else", did  
you ask the user for the crash log and anything that gets logged to  
the console at the time of the crash?


Nick Zitzman

Re: Rosetta Quandry

2010-02-02 Thread Nick Zitzmann

On Feb 2, 2010, at 9:11 PM, David Blanton wrote:

> Yes, I have the crash log that is generated when launching with Rosetta off 
> which I include here for list perusal. Interestingly, I just got off the 
> phone with an Apple Consulting Engineer who let me know that there have been 
> problems (mostly video) with the 27" iMac where this problem manifests 
> itself. There have been two firmware updates.  we have seen this problem ONLY 
> on 27" iMacs.  Makes ya wonder!

It looks like you're using some C++ code. Have you installed any C++ exception 
handlers? I suspect you've got an exception that is being thrown for whatever 
reason and is not being caught, and it's causing a crash.

Nick Zitzmann




___

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

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


Re: Rosetta Quandry

2010-02-02 Thread David Blanton
I can't answer that just now as this is a joint development effort and  
some of the libs I link I am not intimately familiar with.  They are C+ 
+.


So you surmise and exception is being raised in x86 code and not ppc  
code. Interesting.


Thanks, I now have a path to travel.

-db

On Feb 2, 2010, at 9:20 PM, Nick Zitzmann wrote:



On Feb 2, 2010, at 9:11 PM, David Blanton wrote:

Yes, I have the crash log that is generated when launching with  
Rosetta off which I include here for list perusal. Interestingly, I  
just got off the phone with an Apple Consulting Engineer who let me  
know that there have been problems (mostly video) with the 27" iMac  
where this problem manifests itself. There have been two firmware  
updates.  we have seen this problem ONLY on 27" iMacs.  Makes ya  
wonder!


It looks like you're using some C++ code. Have you installed any C++  
exception handlers? I suspect you've got an exception that is being  
thrown for whatever reason and is not being caught, and it's causing  
a crash.


Nick Zitzmann









___

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

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


Awkward issue deallocing document

2010-02-02 Thread Graham Cox
My document subclass retains a reference to an object representing the data 
model. When the document is dealloc'ed, the DM object is released.

One of my app's main menus has dynamic content built from the DM found in the 
current document. This is done by setting the app delegate to also be the 
menu's delegate, and populating the menu using 
-menu:updateItem:atIndex:shouldCancel: which gets DM information from the 
current document.

A menu item can set the DM as its represented object, therefore also retaining 
it.

When the document is closed and dealloced, the DM is not always dealloced 
because the menu item will still be retaining it. The dealloc can be triggered 
by forcing a menu update (e.g. click in the menu bar) which updates the menu, 
finds the old document gone and so repopulates the menu.

The fact that the menu holds on to the DM after its document has gone wouldn't 
really matter too much, except that it's possible for the stale DM to cause 
problems during a subsequent file load. This is to do with it subscribing to 
certain notifications that can be triggered during a load, and when handling 
these notifications, referring to the (now long gone, and hence stale) document 
instance.

I've fixed this particular problem, but I feel it would be better if at doc 
close/dealloc time, I could force a clear out of the menu's represented 
objects, so that the DM dealloc is never deferred until later. So my question 
is, is there a straightforward way to force a given (main) menu to release its 
represented objects at that time?

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

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


  1   2   >