Better handling of the circular references between the graphics context

and the window.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26539 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2008-05-18 23:12:24 +00:00
parent d7968bb04b
commit 957c0f13d5
3 changed files with 114 additions and 72 deletions

View file

@ -195,15 +195,8 @@ NSGraphicsContext *GSCurrentContext(void)
+ (NSGraphicsContext *) graphicsContextWithAttributes: (NSDictionary *)attributes
{
NSGraphicsContext *ctxt;
if (self == [NSGraphicsContext class])
{
NSAssert(defaultNSGraphicsContextClass,
@"Internal Error: No default NSGraphicsContext set\n");
ctxt = [[defaultNSGraphicsContextClass allocWithZone: _globalGSZone]
initWithContextInfo: attributes];
}
else
ctxt = [[self allocWithZone: _globalGSZone] initWithContextInfo: attributes];
ctxt = [[self alloc] initWithContextInfo: attributes];
return AUTORELEASE(ctxt);
}
@ -276,6 +269,23 @@ NSGraphicsContext *GSCurrentContext(void)
[self notImplemented: _cmd];
}
+ (id) alloc
{
return [self allocWithZone: _globalGSZone];
}
+ (id) allocWithZone: (NSZone*)z
{
if (self == [NSGraphicsContext class])
{
NSAssert(defaultNSGraphicsContextClass,
@"Internal Error: No default NSGraphicsContext set\n");
return [defaultNSGraphicsContextClass allocWithZone: z];
}
else
return [super allocWithZone: z];
}
- (void) dealloc
{
DESTROY(usedFonts);