Fixes for formatters, sliders and other classes, stabilizing changes to prevent crashes

This commit is contained in:
Gregory John Casamento 2023-08-27 15:05:47 -04:00
parent 16123a7dd6
commit df327e7fc6

View file

@ -297,6 +297,8 @@ static NSUInteger _count = INT_MAX;
_skipClass = _skipClass =
[[NSArray alloc] initWithObjects: [[NSArray alloc] initWithObjects:
@"NSBrowserCell", @"NSBrowserCell",
@"NSDateFormatter",
@"NSNumberFormatter",
nil]; nil];
_skipCollectionForKey = _skipCollectionForKey =
@ -309,6 +311,7 @@ static NSUInteger _count = INT_MAX;
@"owner", @"owner",
@"subviews", @"subviews",
@"contentView", @"contentView",
@"titleCell",
nil]; nil];
_singletonObjects = _singletonObjects =
@ -448,6 +451,7 @@ static NSUInteger _count = INT_MAX;
@"nextKeyView", @"nextKeyView",
@"prototype", @"prototype",
@"keyCell", @"keyCell",
@"isLenient",
nil]; nil];
} }
} }
@ -1092,6 +1096,7 @@ static NSUInteger _count = INT_MAX;
NSUInteger c = 0; NSUInteger c = 0;
NSUInteger r = 0; NSUInteger r = 0;
NSArray *cells = [matrix cells]; NSArray *cells = [matrix cells];
NSUInteger count = [cells count];
NSUInteger i = 0; NSUInteger i = 0;
NSXMLElement *cellsElem = [NSXMLNode elementWithName: @"cells"]; NSXMLElement *cellsElem = [NSXMLNode elementWithName: @"cells"];
NSString *cellClass = nil; NSString *cellClass = nil;
@ -1099,6 +1104,8 @@ static NSUInteger _count = INT_MAX;
NSDebugLog(@"cells = %@\nelem = %@", [matrix cells], elem); NSDebugLog(@"cells = %@\nelem = %@", [matrix cells], elem);
NSLog(@"WARNING: NSMatrix is not fully supported by Xcode, this might cause it to crash or may not be reloadable by this application"); NSLog(@"WARNING: NSMatrix is not fully supported by Xcode, this might cause it to crash or may not be reloadable by this application");
if (count > 0)
{
[elem addChild: cellsElem]; [elem addChild: cellsElem];
for (c = 0; c < itemsPerCol; c++) for (c = 0; c < itemsPerCol; c++)
{ {
@ -1109,6 +1116,13 @@ static NSUInteger _count = INT_MAX;
id cell = nil; id cell = nil;
i = (c * itemsPerCol) + r; i = (c * itemsPerCol) + r;
// If we go past the end of the array...
if (i >= count)
{
continue;
}
cell = [cells objectAtIndex: i]; cell = [cells objectAtIndex: i];
if (cellClass == nil) if (cellClass == nil)
{ {
@ -1120,6 +1134,7 @@ static NSUInteger _count = INT_MAX;
} }
[cellsElem addChild: columnElem]; [cellsElem addChild: columnElem];
} }
}
// Add the cell class, so that it doesn't crash on reload... // Add the cell class, so that it doesn't crash on reload...
if (cellClass != nil) if (cellClass != nil)