Skip to content

Commit

Permalink
Removing use of -retain (incompatible with ARC). (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojb authored and wjakob committed Aug 10, 2017
1 parent 275aa69 commit f9c3951
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ if (APPLE OR CMAKE_SYSTEM MATCHES "Linux")
list(APPEND LIBNANOGUI_PYTHON_EXTRA_SOURCE ext/coro/coro.c)
endif()

if (APPLE)
# Use automatic reference counting for Objective-C portions
add_compile_options(-fobjc-arc)
endif()

add_definitions(${NANOGUI_EXTRA_DEFS})

# Compile main NanoGUI library
Expand Down
4 changes: 2 additions & 2 deletions src/darwin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
std::string file_dialog(const std::vector<std::pair<std::string, std::string>> &filetypes, bool save) {
std::string path = "";
if (save) {
NSSavePanel *saveDlg = [[NSSavePanel savePanel] retain];
NSSavePanel *saveDlg = [NSSavePanel savePanel];

NSMutableArray *types = [NSMutableArray new];
for (size_t idx = 0; idx < filetypes.size(); ++idx)
Expand All @@ -17,7 +17,7 @@
if ([saveDlg runModal] == NSModalResponseOK)
path = [[[saveDlg URL] path] UTF8String];
} else {
NSOpenPanel *openDlg = [[NSOpenPanel openPanel] retain];
NSOpenPanel *openDlg = [NSOpenPanel openPanel];

[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:NO];
Expand Down

0 comments on commit f9c3951

Please sign in to comment.