mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:20:49 +00:00
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:
parent
d7968bb04b
commit
957c0f13d5
3 changed files with 114 additions and 72 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue