Make sure context is released

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13654 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-05-14 18:49:00 +00:00
parent b61f4db419
commit f7edb957d6
2 changed files with 12 additions and 0 deletions

View file

@ -1212,6 +1212,8 @@ scaleRect(NSRect rect, double scale)
- (NSGraphicsContext*)createContext
{
NSMutableDictionary *info;
NSAutoreleasePool *pool;
if (_context)
return _context;
@ -1220,7 +1222,11 @@ scaleRect(NSRect rect, double scale)
[info setObject: _path forKey: @"NSOutputFile"];
[info setObject: NSGraphicsContextPSFormat
forKey: NSGraphicsContextRepresentationFormatAttributeName];
/* We have to remove the autorelease from the context, because we need the
contents of the file before the next return to the run loop */
pool = [NSAutoreleasePool new];
_context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]);
[pool release];
return _context;
}