From 4f2dbe266209df4e671a4e9a66fd5c1e0507c19a Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 7 Jan 2016 16:01:11 -0500 Subject: [PATCH] Really fixed the NSMapTable nonsense now. Added a TODO to go through the rest of the code for the same. --- TODO.md | 2 ++ darwin/map.m | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 7829b1d3..916a8742 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,5 @@ +- go through ALL the objective-c objects we create and make sure we are using the proper ownership (alloc/init and new are owned by us, all class method constructors are autoreleased - thanks mikeash) + - on OS X, edit shortcuts like command-C working require that the menu entries be defined, or so it seems, even for NSAlert - other platforms? diff --git a/darwin/map.m b/darwin/map.m index a66d0cd2..9fa2de96 100644 --- a/darwin/map.m +++ b/darwin/map.m @@ -13,10 +13,9 @@ struct mapTable *newMap(void) struct mapTable *m; m = uiNew(struct mapTable); - m->m = [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality) - valueOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality)]; - // TODO why do I need this - [m->m retain]; + m->m = [[NSMapTable alloc] initWithKeyOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality) + valueOptions:(NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality) + capacity:0]; return m; }