Add unbind call to dealloc methods, add children method to proxy class, cleanup

This commit is contained in:
Gregory John Casamento 2024-07-05 01:40:51 -04:00
parent 7aee7f6667
commit 90d94fea22
4 changed files with 18 additions and 9 deletions

View file

@ -44,7 +44,7 @@ extern "C" {
withController: (id)controller;
- (NSUInteger) count;
- (NSMutableArray *) childNodes;
- (NSMutableArray *) children;
@end
#if defined(__cplusplus)

View file

@ -57,7 +57,7 @@
return [children count];
}
- (NSMutableArray *) childNodes
- (NSMutableArray *) children
{
NSDictionary *ro = [self representedObject];
NSMutableArray *children = [ro objectForKey: @"children"];

View file

@ -204,6 +204,8 @@ static NSImage *unexpandable = nil;
- (void) dealloc
{
[GSKeyValueBinding unbindAllForObject: self];
RELEASE(_items);
RELEASE(_expandedItems);
@ -773,12 +775,18 @@ static NSImage *unexpandable = nil;
// This method is @optional in NSOutlineViewDataSource as of macOS10.0
// CHECK_REQUIRED_METHOD(outlineView:objectValueForTableColumn:byItem:);
// Is the data source editable?
_dataSource_editable = [anObject respondsToSelector:
@selector(outlineView:setObjectValue:forTableColumn:byItem:)];
}
// Is the data source editable?
_dataSource_editable = [anObject respondsToSelector:
@selector(outlineView:setObjectValue:forTableColumn:byItem:)];
else
{
/* Based on testing on macOS, this should default to YES if there is a binding...
*/
_dataSource_editable = YES;
}
/* We do *not* retain the dataSource, it's like a delegate */
_dataSource = anObject;
[self tile];
@ -2056,7 +2064,6 @@ Also returns the child index relative to this parent. */
if (startitem == nil)
{
NSTreeNode *node = (NSTreeNode *)[theBinding destinationValue];
NSDictionary *representedObject = [node representedObject];
/* Per the documentation 10.4/5+ uses NSTreeNode as the return value for
* the contents of this tree node consists of a dictionary with a single
@ -2065,7 +2072,7 @@ Also returns the child index relative to this parent. */
* _NSControllerTreeProxy. The equivalent of that class in GNUstep is
* GSControllerTreeProxy.
*/
children = [representedObject objectForKey: @"children"];
children = [node children];
num = [children count];
}
else

View file

@ -2083,6 +2083,8 @@ static void computeNewSelection
{
[self abortEditing];
[GSKeyValueBinding unbindAllForObject: self];
RELEASE (_gridColor);
RELEASE (_backgroundColor);
RELEASE (_tableColumns);