Don't do initialization that requires the shared application object/backend too early (ie. move it from +initialize to other methods). Add some asserts to try to catch these errors in the future.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17503 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-08-20 12:43:52 +00:00
parent a78145d257
commit 67d18e5444
4 changed files with 46 additions and 6 deletions

View file

@ -375,19 +375,23 @@ this happens when layout has been invalidated, and when we are resized.
{
[self setVersion: currentVersion];
notificationCenter = [NSNotificationCenter defaultCenter];
[self registerForServices];
}
}
static BOOL did_register_for_services;
+(void) registerForServices
{
NSArray *types;
did_register_for_services = YES;
types = [NSArray arrayWithObjects: NSStringPboardType,
NSRTFPboardType, NSRTFDPboardType, nil];
[[NSApplication sharedApplication] registerServicesMenuSendTypes: types
returnTypes: types];
NSAssert(NSApp, @"Called before the shared application object was created.");
[NSApp registerServicesMenuSendTypes: types
returnTypes: types];
}
+(NSDictionary *) defaultTypingAttributes
@ -474,6 +478,9 @@ If a text view is added to an empty text network, it keeps its attributes.
if (!self)
return nil;
if (!did_register_for_services)
[isa registerForServices];
_minSize = NSMakeSize(0, 0);
_maxSize = NSMakeSize(HUGE,HUGE);
_textContainerInset = NSMakeSize(2, 0);