Rely on ARC to manage GCD types (10.8)

This commit is contained in:
Allan Odgaard
2015-08-04 13:19:55 +02:00
parent e2be8a104d
commit 469fd74a7b
11 changed files with 1 additions and 30 deletions

View File

@@ -60,11 +60,7 @@ int main (int argc, char const* argv[])
}
try {
int res = NSApplicationMain(argc, argv);
dispatch_release(sigUsr1Src);
dispatch_release(sigIntSrc);
dispatch_release(sigTermSrc);
return res;
return NSApplicationMain(argc, argv);
}
catch(std::exception const& e) {
crash_reporter_info_t info(text::format("C++ Exception: %s", e.what()));

View File

@@ -219,8 +219,6 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
}
}
}
dispatch_release(group);
}
}
return self;

View File

@@ -3298,7 +3298,6 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle";
io::exhaust_fd(process.err, &error);
});
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
dispatch_release(group);
if(res = WIFEXITED(status) && WEXITSTATUS(status) == 0)
{

View File

@@ -48,7 +48,6 @@ namespace command
{
runner_t () = delete;
runner_t (bundle_command_t const& command, ng::buffer_api_t const& buffer, ng::ranges_t const& selection, std::map<std::string, std::string> const& environment, std::string const& pwd, delegate_ptr delegate);
~runner_t ();
void launch ();
void wait ();

View File

@@ -115,14 +115,11 @@ static pid_t run_command (dispatch_group_t rootGroup, std::string const& cmd, in
perror("waitpid");
});
dispatch_retain(rootGroup);
dispatch_group_enter(rootGroup);
dispatch_group_notify(group, queue, ^{
completionHandler(status);
dispatch_group_leave(rootGroup);
dispatch_release(rootGroup);
});
dispatch_release(group);
return pid;
}
@@ -145,11 +142,6 @@ namespace command
fix_shebang(&_command.command);
}
runner_t::~runner_t ()
{
dispatch_release(_dispatch_group);
}
runner_ptr runner (bundle_command_t const& command, ng::buffer_api_t const& buffer, ng::ranges_t const& selection, std::map<std::string, std::string> const& environment, delegate_ptr delegate, std::string const& pwd)
{
return std::make_shared<runner_t>(command, buffer, selection, environment, pwd, delegate);

View File

@@ -28,7 +28,6 @@ std::string merge (std::string const& oldContent, std::string const& myContent,
perror("waitpid");
});
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
dispatch_release(group);
if(conflict)
*conflict = WIFEXITED(status) && WEXITSTATUS(status) != 0;

View File

@@ -430,7 +430,6 @@ namespace ng
perror("waitpid");
});
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
dispatch_release(group);
}
unlink(scriptPath.c_str());

View File

@@ -121,10 +121,7 @@ namespace io
});
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
dispatch_release(group);
D(DBF_IO_Exec, if(!error.empty()) bug("error from command: “%s”\n", error.c_str()););
return success ? output : NULL_STR;
}

View File

@@ -27,10 +27,7 @@ namespace network
tbz_t::~tbz_t ()
{
if(_group)
{
dispatch_group_wait(_group, DISPATCH_TIME_FOREVER);
dispatch_release(_group);
}
}
bool tbz_t::wait_for_tbz (std::string* output, std::string* error)

View File

@@ -397,7 +397,6 @@ namespace scm
dispatch_semaphore_signal(semaphore);
});
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_release(semaphore);
info->pop_callback();
}

View File

@@ -62,10 +62,7 @@ private:
~track_fds_t ()
{
for(auto pair : _records)
{
dispatch_source_cancel(pair.second->source);
dispatch_release(pair.second->source);
}
_records.clear();
}
@@ -91,7 +88,6 @@ private:
if(pair != _records.end())
{
dispatch_source_cancel(pair->second->source);
dispatch_release(pair->second->source);
_records.erase(pair);
}
}