Fix crash on empty progress title on OS X
This commit is contained in:
parent
16804f41c9
commit
14d64daf69
3 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace agi {
|
|||
class AppNapDisabler {
|
||||
void *handle;
|
||||
public:
|
||||
AppNapDisabler(std::string const& reason);
|
||||
AppNapDisabler(std::string reason);
|
||||
~AppNapDisabler();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue