mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 10:50:37 +00:00
[graphicsContextWithAttributes] always autorelease the context.
Moved the unsetting of the current context from [dealloc] to [destroyContext] otherwise the current context can never be freed. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12813 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bbe77d04d6
commit
b9f9ae3f20
1 changed files with 4 additions and 4 deletions
|
@ -153,11 +153,11 @@ NSGraphicsContext *GSCurrentContext()
|
|||
@"Internal Error: No default NSGraphicsContext set\n");
|
||||
ctxt = [[defaultNSGraphicsContextClass allocWithZone: _globalGSZone]
|
||||
initWithContextInfo: attributes];
|
||||
AUTORELEASE(ctxt);
|
||||
}
|
||||
else
|
||||
ctxt = [[self allocWithZone: _globalGSZone] initWithContextInfo: attributes];
|
||||
return ctxt;
|
||||
|
||||
return AUTORELEASE(ctxt);
|
||||
}
|
||||
|
||||
+ (NSGraphicsContext *) graphicsContextWithWindow: (NSWindow *)aWindow
|
||||
|
@ -182,8 +182,6 @@ NSGraphicsContext *GSCurrentContext()
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (GSCurrentContext() == self)
|
||||
[NSGraphicsContext setCurrentContext: nil];
|
||||
DESTROY(focus_stack);
|
||||
DESTROY(context_data);
|
||||
DESTROY(context_info);
|
||||
|
@ -196,6 +194,8 @@ NSGraphicsContext *GSCurrentContext()
|
|||
the next autorelease pool end */
|
||||
- (void) destroyContext
|
||||
{
|
||||
if (GSCurrentContext() == self)
|
||||
[NSGraphicsContext setCurrentContext: nil];
|
||||
[contextLock lock];
|
||||
[contextList removeObject: self];
|
||||
[contextLock unlock];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue