Fix crash on empty progress title on OS X

This commit is contained in:
Thomas Goyne 2014-03-26 09:24:47 -07:00
parent 16804f41c9
commit 14d64daf69
3 changed files with 4 additions and 3 deletions

View File

@ -137,7 +137,7 @@ std::pair<size_t, size_t> ifind(std::string const& haystack, std::string const&
#ifndef __APPLE__
namespace osx {
AppNapDisabler::AppNapDisabler(std::string const& reason) { }
AppNapDisabler::AppNapDisabler(std::string reason) { }
AppNapDisabler::~AppNapDisabler() { }
}
#endif

View File

@ -35,7 +35,7 @@ namespace agi {
class AppNapDisabler {
void *handle;
public:
AppNapDisabler(std::string const& reason);
AppNapDisabler(std::string reason);
~AppNapDisabler();
};
}

View File

@ -29,7 +29,8 @@ static std::string EmptyIfNil(NSString *string) {
namespace agi {
namespace osx {
AppNapDisabler::AppNapDisabler(std::string const& reason) : handle(nullptr) {
AppNapDisabler::AppNapDisabler(std::string reason) : handle(nullptr) {
if (reason.empty()) reason = "Loading";
auto processInfo = [NSProcessInfo processInfo];
if ([processInfo respondsToSelector:@selector(beginActivityWithOptions:reason:)])
handle = [[processInfo beginActivityWithOptions:NSActivityUserInitiatedAllowingIdleSystemSleep