From e7ecd92cbc49d65b39beb6d1d10fc7fdee4aa51d Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 2 Jul 2013 17:16:55 +0100 Subject: [PATCH] Fixed: custom CPWindow subclasses breaking flatten. If a cib file had a custom CPWindow subclass, that cib file would not be properly processed by flatten as it'd fail to find the relevant class (the fact that the class can't be found is an issue in itself). This would cause an exception. This fix makes CPCibWindowTemplate act similar to CPCibCustomView when the referenced class can't be found: it instantiates a regular CPWindow. This is sufficient for flatten's purposes. --- AppKit/Cib/_CPCibWindowTemplate.j | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AppKit/Cib/_CPCibWindowTemplate.j b/AppKit/Cib/_CPCibWindowTemplate.j index 869469626..a7e98a402 100644 --- a/AppKit/Cib/_CPCibWindowTemplate.j +++ b/AppKit/Cib/_CPCibWindowTemplate.j @@ -87,12 +87,17 @@ - (id)_cibInstantiate { - var windowClass = CPClassFromString([self windowClass]), - theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask]; + var windowClass = CPClassFromString([self windowClass]); -/* if (!windowClass) - [NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass]; - class=[NSWindow class];*/ + if (!windowClass) + { +#if DEBUG + CPLog.warn("Unknown class \"%@\" in cib file, using CPWindow instead.", [self windowClass]); +#endif + windowClass = [CPWindow class]; + } + + var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask]; if (_minSize) [theWindow setMinSize:_minSize];