mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-21 02:31:01 +00:00
Fix a whole bunch of space leaks in StepTalk.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@38145 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cf50d0e507
commit
54ff99c389
12 changed files with 98 additions and 42 deletions
|
@ -1,3 +1,10 @@
|
|||
2014-11-01 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Frameworks/StepTalk/STClassInfo.m (-dealloc): Release superclass
|
||||
and superclassName attributes.
|
||||
* Frameworks/StepTalk/STEnvironment.m (-initWithDescription:):
|
||||
Remove duplicated RETAIN statement.
|
||||
|
||||
2013-05-27 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Frameworks/StepTalk/NSInvocation+additions.m
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(superclass);
|
||||
RELEASE(superclassName);
|
||||
RELEASE(selectorCache);
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
Return object with name <var>objName</var>. If object is not found int the
|
||||
Return object with name <var>objName</var>. If object is not found in the
|
||||
object dictionary, then object finders are used to try to find the object.
|
||||
If object is found by an object finder, then it is put into the object
|
||||
dicitonary. If there is no object with given name, <var>nil</var> is
|
||||
|
|
|
@ -116,7 +116,6 @@ STEnvironment *sharedEnvironment = nil;
|
|||
infoCache = [[NSMutableDictionary alloc] init];
|
||||
|
||||
description = RETAIN(aDescription);
|
||||
RETAIN(description);
|
||||
classes = [description classes];
|
||||
|
||||
/* Load modules */
|
||||
|
@ -244,7 +243,7 @@ STEnvironment *sharedEnvironment = nil;
|
|||
----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Return object with name <var>objName</var>. If object is not found int the
|
||||
Return object with name <var>objName</var>. If object is not found in the
|
||||
object dictionary, then object finders are used to try to find the object.
|
||||
If object is found by an object finder, then it is put into the object
|
||||
dicitonary. If there is no object with given name, <var>nil</var> is
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
2014-11-01 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* STBlock.m (-dealloc): Release cachedContext attribute.
|
||||
* STBlockContext.m (-dealloc): Restore method to release homeContext
|
||||
attribute.
|
||||
* STBytecodeInterpreter.m (-dealloc): Fix typo in method name and
|
||||
release activeContext attribute.
|
||||
* STBytecodeInterpreter.m (-interpretMethod:forReceiver:arguments:):
|
||||
Release newContext also when an exception is raised while interpreting
|
||||
the method.
|
||||
* STCompiledScript.m (-executeInEnvironment:): Release script object
|
||||
also when an exception is raised while interpreting the script.
|
||||
* STCompiler.m (-dealloc): Release environment attribute.
|
||||
* STCompiler.m (-compileString:): Release local auto release pool also
|
||||
when an exception is raised during compilation.
|
||||
* STSmalltalkScriptObject.m (-forwardInvocation:): Release local
|
||||
autorelease pool and args array also when an exception is raised while
|
||||
interpreting the method.
|
||||
|
||||
2014-10-14 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* STBlockContext.h (STExecutionContext, -initWithInitialIP:stackSize:):
|
||||
|
|
|
@ -64,6 +64,7 @@ Class STBlockContextClass = nil;
|
|||
{
|
||||
RELEASE(homeContext);
|
||||
RELEASE(interpreter);
|
||||
RELEASE(cachedContext);
|
||||
[super dealloc];
|
||||
}
|
||||
- (NSUInteger)argumentCount
|
||||
|
|
|
@ -46,6 +46,11 @@
|
|||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(homeContext);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)isBlockContext
|
||||
{
|
||||
|
|
|
@ -97,9 +97,10 @@ static Class NSInvocation_class = nil;
|
|||
environment = RETAIN(env);
|
||||
return self;
|
||||
}
|
||||
- (void)delloc
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(environment);
|
||||
RELEASE(activeContext);
|
||||
[super dealloc];
|
||||
}
|
||||
- (void)setEnvironment:(STEnvironment *)env
|
||||
|
@ -161,11 +162,13 @@ static Class NSInvocation_class = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
RELEASE(newContext);
|
||||
[localException raise];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASE(newContext);
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
|
|
@ -101,46 +101,56 @@ static SEL finalizeSelector;
|
|||
|
||||
methodCount = [methodDictionary count];
|
||||
|
||||
if(methodCount == 0)
|
||||
if (methodCount == 0)
|
||||
{
|
||||
NSLog(@"Empty script executed");
|
||||
}
|
||||
else if(methodCount == 1)
|
||||
else if (methodCount == 1)
|
||||
{
|
||||
NSString *selName = [[methodDictionary allKeys] objectAtIndex:0];
|
||||
SEL sel = STSelectorFromString(selName);
|
||||
|
||||
NSDebugLog(@"Executing single-method script. (%@)", selName);
|
||||
|
||||
retval = [object performSelector:sel];
|
||||
NS_DURING
|
||||
retval = [object performSelector:sel];
|
||||
NS_HANDLER
|
||||
RELEASE(object);
|
||||
[localException raise];
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
else if(![object respondsToSelector:mainSelector])
|
||||
else if (![object respondsToSelector:mainSelector])
|
||||
{
|
||||
NSLog(@"No 'main' method found");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( [object respondsToSelector:initializeSelector] )
|
||||
{
|
||||
NSDebugLog(@"Sending 'startUp' to script object");
|
||||
[object performSelector:initializeSelector];
|
||||
}
|
||||
NS_DURING
|
||||
if ([object respondsToSelector:initializeSelector])
|
||||
{
|
||||
NSDebugLog(@"Sending 'startUp' to script object");
|
||||
[object performSelector:initializeSelector];
|
||||
}
|
||||
|
||||
if( [object respondsToSelector:mainSelector] )
|
||||
{
|
||||
retval = [object performSelector:mainSelector];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"No 'main' found in script");
|
||||
}
|
||||
if ([object respondsToSelector:mainSelector])
|
||||
{
|
||||
retval = [object performSelector:mainSelector];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"No 'main' found in script");
|
||||
}
|
||||
|
||||
if( [object respondsToSelector:finalizeSelector] )
|
||||
{
|
||||
NSDebugLog(@"Sending 'shutDown' to script object");
|
||||
[object performSelector:finalizeSelector];
|
||||
}
|
||||
if ([object respondsToSelector:finalizeSelector])
|
||||
{
|
||||
NSDebugLog(@"Sending 'shutDown' to script object");
|
||||
[object performSelector:finalizeSelector];
|
||||
}
|
||||
NS_HANDLER
|
||||
RELEASE(object);
|
||||
[localException raise];
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
|
||||
RELEASE(object);
|
||||
|
|
|
@ -150,6 +150,7 @@ extern int STCparse(void *context);
|
|||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
RELEASE(environment);
|
||||
RELEASE(receiverVars);
|
||||
RELEASE(namedReferences);
|
||||
[super dealloc];
|
||||
|
@ -264,6 +265,7 @@ extern int STCparse(void *context);
|
|||
|
||||
if(!environment)
|
||||
{
|
||||
[pool release];
|
||||
[NSException raise:STCompilerGenericException
|
||||
format:@"Compilation environment is not initialized"];
|
||||
return nil;
|
||||
|
@ -286,24 +288,29 @@ extern int STCparse(void *context);
|
|||
{
|
||||
NSString *tokenString;
|
||||
NSInteger line;
|
||||
|
||||
tokenString = [reader tokenString];
|
||||
|
||||
tokenString = RETAIN([reader tokenString]);
|
||||
line = [reader currentLine];
|
||||
|
||||
|
||||
RELEASE(reader);
|
||||
reader = nil;
|
||||
|
||||
RETAIN(localException);
|
||||
[pool release];
|
||||
|
||||
[NSException raise:STCompilerSyntaxException
|
||||
format:exceptionFmt,
|
||||
(long)line,
|
||||
tokenString,
|
||||
[localException reason]];
|
||||
AUTORELEASE(tokenString),
|
||||
[AUTORELEASE(localException) reason]];
|
||||
|
||||
}
|
||||
RELEASE(reader);
|
||||
reader = nil;
|
||||
|
||||
[localException raise];
|
||||
RETAIN(localException);
|
||||
[pool release];
|
||||
[AUTORELEASE(localException) raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
|
|
|
@ -196,11 +196,18 @@
|
|||
// NSDebugLLog(@"STSending",
|
||||
// @">> forwarding to self ...");
|
||||
|
||||
retval = [interpreter interpretMethod:method
|
||||
forReceiver:self
|
||||
arguments:args];
|
||||
RELEASE(args);
|
||||
|
||||
NS_DURING
|
||||
retval = [interpreter interpretMethod:method
|
||||
forReceiver:self
|
||||
arguments:args];
|
||||
RELEASE(args);
|
||||
NS_HANDLER
|
||||
RETAIN(localException);
|
||||
RELEASE(args);
|
||||
[pool release];
|
||||
[AUTORELEASE(localException) raise];
|
||||
NS_ENDHANDLER
|
||||
|
||||
// NSDebugLLog(@"STSending",
|
||||
// @"<< returned from forwarding");
|
||||
|
||||
|
|
|
@ -78,15 +78,11 @@
|
|||
STCompiledScript *compiledScript;
|
||||
id retval = nil;
|
||||
|
||||
compiler = [[STCompiler alloc] init];
|
||||
|
||||
[compiler setEnvironment:context];
|
||||
compiler = [STCompiler compilerWithEnvironment:context];
|
||||
|
||||
compiledScript = [compiler compileString:script];
|
||||
retval = [compiledScript executeInEnvironment:context];
|
||||
|
||||
AUTORELEASE(compiler);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue