mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 02:01:03 +00:00
Free closure via NSData
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13533 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6a90d806a3
commit
13c0170d26
1 changed files with 5 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
#include <Foundation/NSDistantObject.h>
|
#include <Foundation/NSDistantObject.h>
|
||||||
|
#include <Foundation/NSData.h>
|
||||||
#include <base/GSInvocation.h>
|
#include <base/GSInvocation.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <objc/objc-api.h>
|
#include <objc/objc-api.h>
|
||||||
|
@ -146,6 +147,7 @@ static IMP gs_objc_msg_forward (SEL sel)
|
||||||
const char *sel_type;
|
const char *sel_type;
|
||||||
cifframe_t *cframe;
|
cifframe_t *cframe;
|
||||||
ffi_closure *cclosure;
|
ffi_closure *cclosure;
|
||||||
|
NSMutableData *amemory;
|
||||||
|
|
||||||
NSMethodSignature *sig;
|
NSMethodSignature *sig;
|
||||||
|
|
||||||
|
@ -169,8 +171,9 @@ static IMP gs_objc_msg_forward (SEL sel)
|
||||||
where it becomes owned by the callback invocation, so we don't have to
|
where it becomes owned by the callback invocation, so we don't have to
|
||||||
worry about freeing it */
|
worry about freeing it */
|
||||||
cframe = cifframe_from_info([sig methodInfo], [sig numberOfArguments], NULL);
|
cframe = cifframe_from_info([sig methodInfo], [sig numberOfArguments], NULL);
|
||||||
/* FIXME: But how to we free this? */
|
/* Free the closure through NSData */
|
||||||
cclosure = NSZoneCalloc(NSDefaultMallocZone(), sizeof(ffi_closure), 1);
|
amemory = [NSMutableData dataWithLength: sizeof(ffi_closure)];
|
||||||
|
cclosure = [amemory mutableBytes];
|
||||||
if (cframe == NULL || cclosure == NULL)
|
if (cframe == NULL || cclosure == NULL)
|
||||||
{
|
{
|
||||||
[NSException raise: NSMallocException format: @"Allocating closure"];
|
[NSException raise: NSMallocException format: @"Allocating closure"];
|
||||||
|
|
Loading…
Reference in a new issue