Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in _macosx.m #2994

Merged
merged 2 commits into from Apr 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/_macosx.m
Expand Up @@ -203,6 +203,7 @@ static int wait_for_stdin(void)
if (interrupted) raise(SIGINT);
}
CFReadStreamClose(stream);
CFRelease(stream);
return 1;
}

Expand Down Expand Up @@ -2103,6 +2104,7 @@ static int _find_maximum(CGFloat values[3])
function,
true,
true);
CGColorSpaceRelease(colorspace);
CGFunctionRelease(function);
if (shading)
{
Expand Down Expand Up @@ -2236,6 +2238,7 @@ static CGRect _find_enclosing_rect(CGPoint points[3])
CGImageRef mask = CGBitmapContextCreateImage(bitmap);
CGContextClipToMask(cr, rect, mask);
CGImageRelease(mask);
CGContextRelease(bitmap);
free(data);
return 0;
}
Expand Down Expand Up @@ -3990,9 +3993,9 @@ static void _data_provider_release(void* info, const void* data, size_t size)
if(window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSString* ns_title = [[NSString alloc]
initWithCString: title
encoding: NSUTF8StringEncoding];
NSString* ns_title = [[[NSString alloc]
initWithCString: title
encoding: NSUTF8StringEncoding] autorelease];
[window setTitle: ns_title];
[pool release];
}
Expand Down Expand Up @@ -4489,7 +4492,12 @@ -(void)save_figure:(id)sender
NSMenu* menu = [button menu];
NSArray* items = [menu itemArray];
unsigned int n = [items count];
int* states = malloc(n*sizeof(int));
int* states = calloc(n, sizeof(int));
if (!states)
{
PyErr_SetString(PyExc_RuntimeError, "calloc failed");
return NULL;
}
int i;
unsigned int m = 0;
NSEnumerator* enumerator = [items objectEnumerator];
Expand All @@ -4504,7 +4512,6 @@ -(void)save_figure:(id)sender
states[i] = 1;
m++;
}
else states[i] = 0;
}
int j = 0;
PyObject* list = PyList_New(m);
Expand Down