diff --git a/Frameworks/ns/src/to_dictionary.mm b/Frameworks/ns/src/to_dictionary.mm index b857cbf6..8762c5b2 100644 --- a/Frameworks/ns/src/to_dictionary.mm +++ b/Frameworks/ns/src/to_dictionary.mm @@ -44,8 +44,8 @@ namespace ns NSDictionary* to_dictionary (plist::any_t const& plist) { CFPropertyListRef res = plist::create_cf_property_list(plist); - NSDictionary* dict = (NSDictionary*)res; - return [dict autorelease]; + NSDictionary* dict = (NSDictionary*)CFBridgingRelease(res); + return dict; } NSMutableDictionary* to_mutable_dictionary (plist::any_t const& plist) diff --git a/Frameworks/ns/target b/Frameworks/ns/target index 3fbf796e..bdd4958a 100644 --- a/Frameworks/ns/target +++ b/Frameworks/ns/target @@ -3,3 +3,6 @@ TEST_SOURCES = tests/*.{cc,mm} LINK += text OakFoundation plist FRAMEWORKS = Cocoa EXPORT = src/*.h + +OBJCXX_FLAGS += -fobjc-arc +LN_FLAGS += -fobjc-arc-cxxlib=libc++ diff --git a/Frameworks/ns/tests/t_key_events.mm b/Frameworks/ns/tests/t_key_events.mm index 46dd4d42..81ab0249 100644 --- a/Frameworks/ns/tests/t_key_events.mm +++ b/Frameworks/ns/tests/t_key_events.mm @@ -28,11 +28,10 @@ - (NSDictionary*)stringAttributes { - static NSDictionary* attrs = [[NSDictionary dictionaryWithObjectsAndKeys: - [NSColor blackColor], NSForegroundColorAttributeName, - [NSFont userFixedPitchFontOfSize:12], NSFontAttributeName, - nil] retain]; - return attrs; + return @{ + NSFontAttributeName: [NSFont userFixedPitchFontOfSize:12], + NSForegroundColorAttributeName: [NSColor blackColor] + }; } - (void)keyDown:(NSEvent*)anEvent @@ -58,7 +57,7 @@ public: void test_key_events () { @autoreleasepool { - OakSetupApplicationWithView([[[MyEventView alloc] initWithFrame:NSMakeRect(0, 0, 200, 100)] autorelease], "key_events"); + OakSetupApplicationWithView([[MyEventView alloc] initWithFrame:NSMakeRect(0, 0, 200, 100)], "key_events"); } } };