Re: Custom NSView subclass - expressing the fact that a property affects the displayed image

2015-05-27 Thread Jonathan Taylor
 The closest I got was creating a macro that uses np_thread_main() (or 
 whatever it was called exactly, it’s part of the pthreads API, IIRC) and 
 throws if it’s not the main thread. I call that e.g. in 
 observeValueForKeyPath overrides whenever I make thread-unsafe calls, so I 
 don’t accidentally make a threaded call.

Ah, that's a good idea. I had wanted to do something like that but had been put 
off by the very large number of possible entry points. observeValueForKeyPath 
is a great idea that is sure to fire if any GUI-bound properties change.

 Of course, it’s only a runtime check, but it’s better than nothing. Sure 
 would be fine if the Static Analyzer could be made to understand KVO and 
 threading and complain about such uses.

I have a suspicion that if you can get the static analyzer to understand that 
then you have probably solved a number of officially Hard problems along the 
way!
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Custom NSView subclass - expressing the fact that a property affects the displayed image

2015-05-27 Thread Uli Kusterer
On 27 May 2015, at 11:00, Jonathan Taylor jonathan.tay...@glasgow.ac.uk wrote:
 Of course, it’s only a runtime check, but it’s better than nothing. Sure 
 would be fine if the Static Analyzer could be made to understand KVO and 
 threading and complain about such uses.
 
 I have a suspicion that if you can get the static analyzer to understand that 
 then you have probably solved a number of officially Hard problems along the 
 way!

 Was thinking more of making it mark certain calls it knows aren’t thread-safe 
as such, and marking every method that is passed to detachNewThreadSelector: or 
the likes as “threaded”, and then warning if the former is used inside or in a 
call hanging off the latter. That sounds like it would lie well within the 
abilities of the static analyzer. But I’m not saying I know that would work. 
I’m really just saying it “Sure would be fine” :-)

Sounds like a heuristic that might work if it doesn’t give too many false 
positives and is kept conservative, though. Doesn’t have to catch all cases, as 
long as it catches a few and avoids false positives.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Problem with Outline View and Manual Memory Management

2015-05-27 Thread Dave
Hi,

Sorry, I wasn’t very clear, the VC is my existing VC with the Source Vice Code 
from “myViewController” code added so this had to be converted to use manual 
memory management. I also converted the other supporting classes although as 
you point out, I could have just set the compiler flag.

Here are the property definitions from ChildNode:

// BaseNide.h

@interface BaseNode : NSObject NSCoding, NSCopying
{
}

@property (nonatomic,retain) NSString*  nodeTitle;
@property (nonatomic,retain) NSImage*   nodeIcon;
@property (nonatomic,retain) NSMutableArray*children;
@property (nonatomic,retain) NSString*  urlString;
@property (nonatomic,assign) BOOL   isLeaf;


// ChildNide.h

@interface ChildNode : BaseNode

———

Here are the property definitions from ImageAndTextCell:

@property (nonatomic,retain) NSImage*   
pTextCellImage;

These two are in the View Controller Itself:

@property (nonatomic,retain) NSImage*   
pFolderImage;
@property (nonatomic,retain) NSImage*   
pURLImage;

Thanks for your help, I’ve worked on loads of Projects where I’ve had to 
convert to/from ARC, but never had a problem like this. I’ve obviously missed 
something, but I’ve been all over the code and it all looks fine. I am worried 
that the Analyser isn’t showing a problem though, I’ve come to rely on it quite 
a bit and the fact that I’ve seem it get it wrong a couple of times makes me 
wonder…..

All the Best
Dave

 On 26 May 2015, at 19:34, Dave d...@looktowindward.com wrote:
 
 Hi,
 
 I’ve incorporated the Tree Controller in SourceView. SourceView shows a Split 
 View with a tree structure on the left and either shows the contents of a URL 
 or a List of Files on the right, depending on which item is selected in the 
 left view.
 
 The SourceView project is built using ARC, but my App uses Manual Memory 
 Management. When I moved the code over, I changed it to use release etc. and 
 changed any properties or iVar’s to use retain or assign. The problem builds 
 with no analyser warnings (which doesn’t mean as much as it used to, because 
 I’ve found that the Analyser in XCode 6.3 is buggy).
 
 When I run the App, it displays the Tree View fine and Populates the two 
 sections, but it crashes due to an over-release if I select a file based item 
 - I found this by using NSZombies - it gives the error:
 
 *** -[NSImage release]: message sent to deallocated instance 0x20e5b9fc0
 
 I traced the problem down to the method copies below - please see comments in 
 code. I’ve stopped it crashing by adding a retain although it doesn’t display 
 the Files Correctly so there is something else wrong. I can’t figure out why 
 I need this extra retain since everything seems to balanced without it.
 
 Any ideas how to debug this would be greatly appreciated.
 
 All the Best
 Dave
 
 - (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell 
 forTableColumn:(NSTableColumn *)tableColumn item:(id) item
 {  
 NSImage*  iconImage;
 NSString* urlStr;
 ImageAndTextCell* myCell;
 ChildNode*myChildNode;
 
 if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME] == NO)
   return;
 
 // we are displaying the single and only column
 if ([cell isKindOfClass:[ImageAndTextCell class]] == NO)
   return;
 
 iconImage = nil;  
 myChildNode = [item representedObject];
 if (myChildNode != nil)
   {
   if (myChildNode.isLeaf == YES)
   {
   urlStr = myChildNode.urlString;
   if (urlStr != nil)
   {
   if ([myChildNode.urlString hasPrefix:HTTP_PREFIX])
   {
   myChildNode.nodeIcon = self.pURLImage;
   }
   else
   {
   iconImage = [[[NSWorkspace sharedWorkspace] 
 iconForFile:urlStr] copy];  //Crashes without retain or if I remove the copy 
 and and release statement below
 
   LogIfDave(@Before Get File iconImage - 
 retainCount: %ld,[iconImage retainCount]);
   myChildNode.nodeIcon = iconImage;
 //*   [iconImage release];
 //** Crashes if 
 Present!
 
   LogIfDave(@After set Item iconImage - 
 retainCount: %ld,[iconImage retainCount]);
   }
   }
   }
   }
 else
 //**
 //**  Check if it's a special folder (PLACES or BOOKMARKS), we don't want it 
 to have an icon
 //**
   {
   if ([self 

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Uli Kusterer
On 26 May 2015, at 19:24, Alex Zavatone z...@mac.com wrote:
 For any nonmutable class, should I be using copy instead of strong or is this 
 just with NSString?

 You should consider that pattern for every class for which a mutable version 
exists that is a subclass of the non-mutable base class (because only in that 
case could someone assign a mutable object to your un-mutable property), and 
which implements NSCopying. For Foundation and other Apple classes that 
considering should lead to using copy.

 For other frameworks you should probably look at their code to make sure they 
work the same way as Apple's. If they don’t use the retain optimization, you’ll 
want to verify that it performs within your constraints (by profiling) and if 
they don’t, maybe add this optimization.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Dave
 With regards to understanding what is going on in the 4000 line view 
 controllers, the areas that were problematic for me were where the instance 
 variables were declared in the interface as someProperty (or as Someproperty, 
 ugh) and then the property was declared and manually synthesized with the 
 same name.  So, then trying to wade through the code with identical names for 
 properties and instance variables and with cases where the variable sometimes 
 starts with a capital letter, knowing exactly what I was looking at was not 
 exactly straightforward.

I’ve done load of this kind of thing in the past, I’ve found the best way to 
handle convert iVar’s to properties is as so:

1.  Refactor/Rename the iVar to the name of the property.
2.  Compile - this should produce no errors, since all you have done is 
change the name of the iVar.
3.  Add a property definition for the Property, this will error since there 
will be an iVar with the same name.
4.  Delete or comment out the iVar.
5.  Compile - there will be errors on the iVar accesses, fix as appropriate.

I’ve found it’s also better to pick a prefix for the names of iVar’s and 
Properties even if you get rid of the prefix once you’ve got it working, e.g.

iVar Name:  mFileNameString
Property Name:  pFileNameString

and if you want to synthesise it:

@synthesize pFileNameString = mFileNameString;

It’s then instantly obviously what you are working on which if you have a 4000+ 
line file helps a lot.

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

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

Re: Problem with Outline View and Manual Memory Management

2015-05-27 Thread Dave
Hi,

Thanks for this, I actually spotted that late last night and I refactored the 
code to read as below, but it still crashes if I do not retain the iconImage:

- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell 
forTableColumn:(NSTableColumn *)tableColumn item:(id) item
{
NSImage*iconImage;
NSString*   urlStr;
ImageAndTextCell*   myCell;
ChildNode*  myChildNode;

if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME] == NO)
return;

if ([cell isKindOfClass:[ImageAndTextCell class]] == NO)
return;

iconImage = nil;
myChildNode = [item representedObject];
if (myChildNode == nil)
return;

if ([myChildNode class] != [ChildNode class])
return;

if (myChildNode.isLeaf == YES)
{
urlStr = myChildNode.urlString;
if (urlStr != nil)
{
if ([myChildNode.urlString hasPrefix:HTTP_PREFIX])
{
myChildNode.nodeIcon = self.pURLImage;
}
else
{
iconImage = [[[NSWorkspace sharedWorkspace] 
iconForFile:urlStr] copy];  //Crashes without retain

LogIfDave(@Before Get File iconImage - retainCount: 
%ld,[iconImage retainCount]);
myChildNode.nodeIcon = iconImage;
//***   [iconImage release];
//** Crashes if Present 

LogIfDave(@After set Item iconImage - retainCount: 
%ld,[iconImage retainCount]);
}
}
}

//**
//**Check if it's a special folder (PLACES or BOOKMARKS), we don't want it 
to have an icon
//**
else
{
if ([self isSpecialGroup:myChildNode])
{
myChildNode.nodeIcon = nil;
}
else
{
myChildNode.nodeIcon = self.pFolderImage;
}
}


[myChildNode.nodeIcon setSize:NSMakeSize(kIconImageSize,kIconImageSize)];
myCell = (ImageAndTextCell*) cell;

iconImage = myChildNode.nodeIcon;

if (iconImage != nil)
LogIfDave(@Before set pTextCellImage - retainCount: %ld,[iconImage 
retainCount]);

myCell.pTextCellImage = iconImage;  // Crashes here 
if release above is present

if (iconImage != nil)
LogIfDave(@After set Item pTextCellImage - retainCount: 
%ld,[iconImage retainCount]);
}


—

This is the Original from SourceView, the problem you spotted is in this code 
too, in that if item == nil, the code at the end will operate on a nil Object 
(item).


- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell 
forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME])
{
// we are displaying the single and only column
if ([cell isKindOfClass:[ImageAndTextCell class]])
{
item = [item representedObject];
if (item != nil)
{
if ([item isLeaf])
{
// does it have a URL string?
NSString *urlStr = [item urlString];
if (urlStr)
{
if ([item isLeaf])
{
NSImage *iconImage;
if ([[item urlString] 
hasPrefix:HTTP_PREFIX])
{
iconImage = 
urlImage;
}
else
{
iconImage = 
[[NSWorkspace sharedWorkspace] iconForFile:urlStr];
}

NSLog(@outlineView: 
willDisplayCell: forTableColumn: item:);  
NSLog(@URL: %@,[item 
urlString]); 

[item 

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Alex Zavatone

On May 27, 2015, at 6:08 AM, Uli Kusterer wrote:

 On 26 May 2015, at 19:24, Alex Zavatone z...@mac.com wrote:
 For any nonmutable class, should I be using copy instead of strong or is 
 this just with NSString?
 
 You should consider that pattern for every class for which a mutable version 
 exists that is a subclass of the non-mutable base class (because only in that 
 case could someone assign a mutable object to your un-mutable property), and 
 which implements NSCopying. For Foundation and other Apple classes that 
 considering should lead to using copy.

For those of us who have not yet had the coffee jump start their brain cell, 
could you possibly reword that so it's a little less obtuse?  

No offense intended, that sentence just sends my brain cell off in too many 
directions.


 For other frameworks you should probably look at their code to make sure they 
 work the same way as Apple's. If they don’t use the retain optimization, 
 you’ll want to verify that it performs within your constraints (by profiling) 
 and if they don’t, maybe add this optimization.

Thanks much,
Alex Zavatone
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:

2015-05-27 Thread Charles Srstka
 On May 27, 2015, at 10:22 AM, Kyle Sluder k...@ksluder.com wrote:
 
 On May 27, 2015, at 8:17 AM, Scott Ribe scott_r...@elevated-dev.com 
 mailto:scott_r...@elevated-dev.com wrote:
 
 
 On May 27, 2015, at 8:20 AM, Kyle Sluder k...@ksluder.com 
 mailto:k...@ksluder.com wrote:
 
 The bug is in your code. It has always been a requirement that you nil out 
 any delegate and datasource backpointers before the thing they point to 
 gets deallocated. You just happened to get away with it due to some aspect 
 of older Xcode versions’ codegen.
 
 I’m pretty sure that a window and it’s views should not be trying to redraw 
 after being closed…
 
 Raglan said nothing about the window being closed.

He said that he fixed it by nilling out the delegate and datasource in 
windowWillClose:. This implies that the crash occurred sometime after the 
window either was closing or had closed.

Again, though, I had this happen with a table view that was in a window that 
neither had closed, nor should have had its datasource/delegate nilled out. It 
was a perfectly valid, active table view in an open window, and when you’d 
click on it to change its selection, it’d crash (but only on 10.6.8, and only 
when compiled with Xcode 6). IMO, Xcode 6 and 10.6.8 are just a bad combo, as I 
doubt Apple has tested compiling for such an old system in some time.

Charles

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Anyone else having trouble with the Provisioning Profile?

2015-05-27 Thread Rick Mann
I emailed devprograms. Typically, though, issues resolve themselves before they 
get back to me. Hence why I asked.

 On May 27, 2015, at 07:21 , Kyle Sluder k...@ksluder.com wrote:
 
 You’ve all filed Radars about this, yes?
 
 --Kyle Sluder
 
 On May 26, 2015, at 6:53 PM, Doug Hill cocoa...@breaqz.com wrote:
 
 I’ve noticed very long loading times for the pages in the Certs, IDs  
 Profiles sections, but it eventually loads.
 I just tried it now in Chrome and it took ~5mins of staring at that spinner 
 for the list of Provisioning profiles to load.
 
 Doug Hill
 https://chartcube.com/ https://chartcube.com/
 Pivot Tables on your iPad
 
 
 On May 26, 2015, at 6:39 PM, Roland King r...@rols.org wrote:
 
 Yep. 1 week it's been busted. 
 
 
 On 27 May 2015, at 07:30, Rick Mann rm...@latencyzero.com 
 mailto:rm...@latencyzero.com wrote:
 
 Anyone else having trouble with the (Mac) Provisioning Profile? I just get 
 the spinner in the area where it normally shows content.
 
 -- 
 Rick Mann
 rm...@latencyzero.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:
 https://lists.apple.com/mailman/options/cocoa-dev/kyle%40ksluder.com
 
 This email sent to k...@ksluder.com


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

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

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Dave

 On 27 May 2015, at 13:37, Alex Zavatone z...@mac.com wrote:
 
 
 On May 27, 2015, at 6:08 AM, Uli Kusterer wrote:
 
 On 26 May 2015, at 19:24, Alex Zavatone z...@mac.com wrote:
 For any nonmutable class, should I be using copy instead of strong or is 
 this just with NSString?
 
 You should consider that pattern for every class for which a mutable version 
 exists that is a subclass of the non-mutable base class (because only in 
 that case could someone assign a mutable object to your un-mutable 
 property), and which implements NSCopying. For Foundation and other Apple 
 classes that considering should lead to using copy.
 
 For those of us who have not yet had the coffee jump start their brain cell, 
 could you possibly reword that so it's a little less obtuse?  
 
 No offense intended, that sentence just sends my brain cell off in too many 
 directions.

I think he meant that there is no “mutableCopy” attribute, which in turn means 
that, if you do this:

@property (nonatomic,copy)  NSMutableArray* 
pMutableArray;


NSMutableArray* myMutableArray;

myMutableArray = [[NSMutableArray alloc] init];
someObj. pMutableArray = myMutableArray;
[myMutableArray release];

Then it assigns a Non—Mutable array to pMutableArray, so use retain instead.


But if you have:

@property (nonatomic,copy)  NSArray*
pImmutableArray;
or
@property (nonatomic,retain)NSArray*
pImmutableArray;


NSArray*myImmutableArray;

myImmutableArray = [[NSArray alloc] init];
someObj. pMutableArray = myImmutableArray;
[myMutableArray release];

Then you end up with the same thing, except the retain counts will differ, but 
if a Mutable array is assigned using (retained), then if the Array contents 
change, then the changes will be reflected in the Array if you used retain, but 
not if you used copy.

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

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

Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:

2015-05-27 Thread Kyle Sluder
 On May 27, 2015, at 8:17 AM, Scott Ribe scott_r...@elevated-dev.com wrote:

 
 On May 27, 2015, at 8:20 AM, Kyle Sluder k...@ksluder.com wrote:
 
 The bug is in your code. It has always been a requirement that you nil out 
 any delegate and datasource backpointers before the thing they point to gets 
 deallocated. You just happened to get away with it due to some aspect of 
 older Xcode versions’ codegen.
 
 I’m pretty sure that a window and it’s views should not be trying to redraw 
 after being closed…

Raglan said nothing about the window being closed.

--Kyle Sluder

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Dave
HI,

A bit more on this, firstly the problem seems to be related to the 
ImageAndTextCell class and secondly looking at the awakeFromNIB method from 
SourceView, ImageAndTextCell is allocated, the property is set, but then it 
does nothing with it. I assume that under ARC ImageAndTextCell will be sent a 
release or will have been autoreleased?

I’ve posted my version of awakeFromNib, which releases it, since I assume that 
[tableColumn setDataCell:imageAndTextCell] retains it.

- (void)awakeFromNib
{
// load the icon view controller for later use
iconViewController = [[IconViewController alloc] 
initWithNibName:ICONVIEW_NIB_NAME bundle:nil];

// load the file view controller for later use
fileViewController = [[FileViewController alloc] 
initWithNibName:FILEVIEW_NIB_NAME bundle:nil];

// load the child edit view controller for later use
childEditController = [[ChildEditController alloc] 
initWithWindowNibName:CHILDEDIT_NAME];

[[self window] setAutorecalculatesContentBorderThickness:YES 
forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:30 forEdge:NSMinYEdge];

// apply our custom ImageAndTextCell for rendering the first column's 
cells
NSTableColumn *tableColumn = [myOutlineView 
tableColumnWithIdentifier:COLUMNID_NAME];

ImageAndTextCell *imageAndTextCell = [[ImageAndTextCell alloc] 
initTextCell:@”];   
//***
[imageAndTextCell setEditable:YES];
[tableColumn setDataCell:imageAndTextCell];
   
separatorCell = [[SeparatorCell alloc] init];
[separatorCell setEditable:NO];

// add our content
[self populateOutlineContents];

// add images to our add/remove buttons
NSImage *addImage = [NSImage imageNamed:NSImageNameAddTemplate];
[addFolderButton setImage:addImage];
NSImage *removeImage = [NSImage imageNamed:NSImageNameRemoveTemplate];
[removeButton setImage:removeImage];

// insert an empty menu item at the beginning of the drown down 
button's menu and add its image
NSImage *actionImage = [NSImage imageNamed:NSImageNameActionTemplate];
[actionImage setSize:NSMakeSize(10,10)];

NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@ action:nil 
keyEquivalent:@];
[[actionButton menu] insertItem:menuItem atIndex:0];
[menuItem setImage:actionImage];

// truncate to the middle if the url is too long to fit
[[urlField cell] setLineBreakMode:NSLineBreakByTruncatingMiddle];

// scroll to the top in case the outline contents is very long
[[[myOutlineView enclosingScrollView] verticalScroller] 
setFloatValue:0.0];
[[[myOutlineView enclosingScrollView] contentView] 
scrollToPoint:NSMakePoint(0,0)];

// make our outline view appear with gradient selection, and behave 
like the Finder, iTunes, etc.
[myOutlineView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];

// drag and drop support
[myOutlineView registerForDraggedTypes:@[kNodesPBoardType,  
// our internal drag type

NSURLPboardType,// single url from pasteboard

NSFilenamesPboardType,  // from Safari or Finder

NSFilesPromisePboardType]];


[webView setUIDelegate:self];   // be the webView's delegate to capture 
NSResponder calls
[webView setFrameLoadDelegate:self];// so we can receive any possible 
errors

[[NSNotificationCenter defaultCenter] addObserver:self
 
selector:@selector(contentReceived:)
 
name:kReceivedContentNotification
   object:nil];
}

——

Adapted version:

-(void) awakeFromNib 
{
IconViewController* myIconViewController;
FileViewController* myFileViewController;
ChildEditController*myChildEditWindowController;
SeparatorCell*  mySeparatorCell;
NSTableColumn*  tableColumn;
ImageAndTextCell*   myImageAndTextCell;

//**
//**Load the Icon and File View Controllers
//**
myIconViewController = [[IconViewController alloc] 
initWithNibName:ICONVIEW_NIB_NAME bundle:nil];
self.pIconViewController = 

Re: Problem with Outline View and Manual Memory Management

2015-05-27 Thread Dave
HI,

A bit more on this, firstly the problem seems to be related to the 
ImageAndTextCell class and secondly looking at the awakeFromNIB method from 
SourceView, ImageAndTextCell is allocated, the property is set, but then it 
does nothing with it. I assume that under ARC ImageAndTextCell will be sent a 
release or will have been autoreleased?

I’ve posted my version of awakeFromNib, which releases it, since I assume that 
[tableColumn setDataCell:imageAndTextCell] retains it.

- (void)awakeFromNib
{
// load the icon view controller for later use
iconViewController = [[IconViewController alloc] 
initWithNibName:ICONVIEW_NIB_NAME bundle:nil];

// load the file view controller for later use
fileViewController = [[FileViewController alloc] 
initWithNibName:FILEVIEW_NIB_NAME bundle:nil];

// load the child edit view controller for later use
childEditController = [[ChildEditController alloc] 
initWithWindowNibName:CHILDEDIT_NAME];

[[self window] setAutorecalculatesContentBorderThickness:YES 
forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:30 forEdge:NSMinYEdge];

// apply our custom ImageAndTextCell for rendering the first column's 
cells
NSTableColumn *tableColumn = [myOutlineView 
tableColumnWithIdentifier:COLUMNID_NAME];

ImageAndTextCell *imageAndTextCell = [[ImageAndTextCell alloc] 
initTextCell:@”];   
//***
[imageAndTextCell setEditable:YES];
[tableColumn setDataCell:imageAndTextCell];

separatorCell = [[SeparatorCell alloc] init];
   [separatorCell setEditable:NO];

   // add our content
[self populateOutlineContents];

// add images to our add/remove buttons
NSImage *addImage = [NSImage imageNamed:NSImageNameAddTemplate];
[addFolderButton setImage:addImage];
NSImage *removeImage = [NSImage imageNamed:NSImageNameRemoveTemplate];
[removeButton setImage:removeImage];

// insert an empty menu item at the beginning of the drown down 
button's menu and add its image
NSImage *actionImage = [NSImage imageNamed:NSImageNameActionTemplate];
[actionImage setSize:NSMakeSize(10,10)];

NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@ action:nil 
keyEquivalent:@];
[[actionButton menu] insertItem:menuItem atIndex:0];
[menuItem setImage:actionImage];

// truncate to the middle if the url is too long to fit
[[urlField cell] setLineBreakMode:NSLineBreakByTruncatingMiddle];

// scroll to the top in case the outline contents is very long
[[[myOutlineView enclosingScrollView] verticalScroller] 
setFloatValue:0.0];
[[[myOutlineView enclosingScrollView] contentView] 
scrollToPoint:NSMakePoint(0,0)];

// make our outline view appear with gradient selection, and behave 
like the Finder, iTunes, etc.
[myOutlineView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];

// drag and drop support
[myOutlineView registerForDraggedTypes:@[kNodesPBoardType,  
// our internal drag type

NSURLPboardType,// single url from pasteboard

NSFilenamesPboardType,  // from Safari or Finder

NSFilesPromisePboardType]];


[webView setUIDelegate:self];   // be the webView's delegate to capture 
NSResponder calls
   [webView setFrameLoadDelegate:self];// so we can receive any possible 
errors

   [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentReceived:)

name:kReceivedContentNotification
  object:nil];
}

——

Adapted version:

-(void) awakeFromNib 
{
IconViewController* myIconViewController;
FileViewController* myFileViewController;
ChildEditController*myChildEditWindowController;
SeparatorCell*  mySeparatorCell;
NSTableColumn*  tableColumn;
ImageAndTextCell*   myImageAndTextCell;

//**
//**Load the Icon and File View Controllers
//**
myIconViewController = [[IconViewController alloc] 
initWithNibName:ICONVIEW_NIB_NAME bundle:nil];
self.pIconViewController = 

Found It - Problem with Outline View and Manual Memory Management

2015-05-27 Thread Dave
Hi,

I’ve Found it, please see line marked below.

In I change this to:

myCell = (ImageAndTextCell*) [cell copy];   
//***

It doesn’t work, which is a bit of a mystery? Because of this, I think there is 
something wrong somewhere else which copying and releasing here is 
working-around the problem, rather than solving at source?

I assume that in the Source Project, under ARC, the value was retained 
auto-magically?

Thanks Again,
Dave



- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell 
forTableColumn:(NSTableColumn *)tableColumn item:(id) item
{
NSImage*iconImage;
NSString*   urlStr;
ImageAndTextCell*   myCell;
ChildNode*  myChildNode;

if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME] == NO)
return;

if ([cell isKindOfClass:[ImageAndTextCell class]] == NO)
return;

myChildNode = [item representedObject];
if (myChildNode == nil)
return;

if ([myChildNode class] != [ChildNode class])
return;

myCell = (ImageAndTextCell*) [cell copy];   
//***
myCell.pTextCellImage = nil;
iconImage = nil;

if (myChildNode.isLeaf == YES)
{
urlStr = myChildNode.urlString;
if (urlStr != nil)
{
if ([myChildNode.urlString hasPrefix:HTTP_PREFIX] == YES)
{
myChildNode.nodeIcon = self.pURLImage;
}
else
{
iconImage = [[NSWorkspace sharedWorkspace] 
iconForFile:urlStr];
myChildNode.nodeIcon = iconImage;
}
}
}

//**
//**Check if it's a special folder (PLACES or BOOKMARKS), we don't want it 
to have an icon
//**
else
{
if ([self isSpecialGroup:myChildNode] == YES)
{
myChildNode.nodeIcon = nil;
}
else
{
myChildNode.nodeIcon = self.pFolderImage;
}
}


[myChildNode.nodeIcon setSize:NSMakeSize(kIconImageSize,kIconImageSize)];

iconImage = myChildNode.nodeIcon;
myCell.pTextCellImage = iconImage;

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

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

Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:

2015-05-27 Thread Scott Ribe
On May 27, 2015, at 8:20 AM, Kyle Sluder k...@ksluder.com wrote:
 
 The bug is in your code. It has always been a requirement that you nil out 
 any delegate and datasource backpointers before the thing they point to gets 
 deallocated. You just happened to get away with it due to some aspect of 
 older Xcode versions’ codegen.

I’m pretty sure that a window and it’s views should not be trying to redraw 
after being closed…

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Anyone else having trouble with the Provisioning Profile?

2015-05-27 Thread Kyle Sluder
You’ve all filed Radars about this, yes?

--Kyle Sluder

 On May 26, 2015, at 6:53 PM, Doug Hill cocoa...@breaqz.com wrote:
 
 I’ve noticed very long loading times for the pages in the Certs, IDs  
 Profiles sections, but it eventually loads.
 I just tried it now in Chrome and it took ~5mins of staring at that spinner 
 for the list of Provisioning profiles to load.
 
 Doug Hill
 https://chartcube.com/ https://chartcube.com/
 Pivot Tables on your iPad
 
 
 On May 26, 2015, at 6:39 PM, Roland King r...@rols.org wrote:
 
 Yep. 1 week it's been busted. 
 
 
 On 27 May 2015, at 07:30, Rick Mann rm...@latencyzero.com 
 mailto:rm...@latencyzero.com wrote:
 
 Anyone else having trouble with the (Mac) Provisioning Profile? I just get 
 the spinner in the area where it normally shows content.
 
 -- 
 Rick Mann
 rm...@latencyzero.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:
 https://lists.apple.com/mailman/options/cocoa-dev/kyle%40ksluder.com
 
 This email sent to k...@ksluder.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: objc_msgSend() selector name: tableView:objectValueForTableColumn:row:

2015-05-27 Thread Kyle Sluder
 On Apr 13, 2015, at 12:11 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 Just a quick follow-up and thanks to those that put me on the right path.
 
 I ran the code in GDB on a 10.6.8 machine and set NSZombieEnabled=YES.  This 
 showed me the object that was released that Cocoa was calling 
 tableView:objectValueForTableColumn:row: on after release.  This was only a 
 problem on 10.6.8 machines.
 
 The solution was to set the datasource and delegate to nil on the table 
 before exiting the stack that started the process.
 
 This does seem to be a bug when building with Xcode 6.2 and 10.9 SDK.

The bug is in your code. It has always been a requirement that you nil out any 
delegate and datasource backpointers before the thing they point to gets 
deallocated. You just happened to get away with it due to some aspect of older 
Xcode versions’ codegen.

This was a large motivation behind Zeroing Weak References (aka __weak in ARC).

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Disabling auto-synthesis of property accessors.

2015-05-27 Thread Dave
Apologies for the mis-post, was supposed to be posted to a different thread.

Not sure if it was me or Mail that had a mis-fire but I’ll blame “Mail” lol.

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

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

Found It - Problem with Outline View and Manual Memory Management

2015-05-27 Thread Dave
Sorry, I meant:

In I change this to:

myCell = (ImageAndTextCell*) [cell retain]; 
//***

It doesn’t work? Presumably now I think about it, because the Image property is 
not retained when I do a retain. When I use copy, it increases the retain count 
by 1.

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

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

Re: Anyone else having trouble with the Provisioning Profile?

2015-05-27 Thread Doug Hill
Should I file a bug report that Apple should have web site performance 
monitoring? Because this seems like something I shouldn’t have to tell them 
about.

Doug

 On May 27, 2015, at 7:21 AM, Kyle Sluder k...@ksluder.com wrote:
 
 You’ve all filed Radars about this, yes?
 
 --Kyle Sluder
 
 On May 26, 2015, at 6:53 PM, Doug Hill cocoa...@breaqz.com wrote:
 
 I’ve noticed very long loading times for the pages in the Certs, IDs  
 Profiles sections, but it eventually loads.
 I just tried it now in Chrome and it took ~5mins of staring at that spinner 
 for the list of Provisioning profiles to load.
 
 Doug Hill
 https://chartcube.com/ https://chartcube.com/
 Pivot Tables on your iPad
 
 
 On May 26, 2015, at 6:39 PM, Roland King r...@rols.org wrote:
 
 Yep. 1 week it's been busted. 
 
 
 On 27 May 2015, at 07:30, Rick Mann rm...@latencyzero.com 
 mailto:rm...@latencyzero.com wrote:
 
 Anyone else having trouble with the (Mac) Provisioning Profile? I just get 
 the spinner in the area where it normally shows content.
 
 -- 
 Rick Mann
 rm...@latencyzero.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:
 https://lists.apple.com/mailman/options/cocoa-dev/kyle%40ksluder.com
 
 This email sent to k...@ksluder.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

NSPathControl

2015-05-27 Thread Raglan T. Tiger
How do I get called by NSPathControl ?  

I can setObjectValue: for the path;  now I want to know what path component the 
users selects.  I am using Pop Up style.


-rags




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Found It - Problem with Outline View and Manual Memory Management

2015-05-27 Thread Graham Cox

 On 28 May 2015, at 12:56 am, Dave d...@looktowindward.com wrote:
 
 myCell = (ImageAndTextCell*) [cell copy]; 
 //***


It’s a “well known”* fact that a copy of an NSCell or any subclass thereof 
basically doesn’t work. You have to override -copyWithZone: and Do It 
Properly™, which means NOT calling super’s implementation first (which 
internally uses NSCopyObject()). I suspect that’s the root cause of your issue.


* I say “well known” in quotes because it’s something that lurks there in the 
frameworks but is never spelt out in documentation, and almost every Mac OS 
developer comes up against it at some point and has to relearn this fact for 
themselves. This is your turn.

—Graham



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSPathControl

2015-05-27 Thread Lee Ann Rucker

On May 27, 2015, at 2:55 PM, Jens Alfke j...@mooseyard.com wrote:

 
 On May 27, 2015, at 2:46 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 I can setObjectValue: for the path;  now I want to know what path component 
 the users selects.  I am using Pop Up style.
 
 It’s an NSControl. Wire up the target/action to your IBAction method, either 
 in IB or programmatically.
 

And then look at clickedPathComponentCell


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSPathControl

2015-05-27 Thread Jens Alfke

 On May 27, 2015, at 2:46 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 I can setObjectValue: for the path;  now I want to know what path component 
 the users selects.  I am using Pop Up style.

It’s an NSControl. Wire up the target/action to your IBAction method, either in 
IB or programmatically.

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

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