Reset SQRLUpdater when setFeedURL is called

This commit is contained in:
Cheng Zhao 2016-06-13 09:38:49 +09:00
parent a3786f66c9
commit 26c4fc34cb

View file

@ -38,12 +38,14 @@ void AutoUpdater::SetFeedURL(const std::string& feed,
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];
for (auto&& it : requestHeaders) {
for (const auto& it : requestHeaders) {
[urlRequest setValue:base::SysUTF8ToNSString(it.second)
forHTTPHeaderField:base::SysUTF8ToNSString(it.first)];
}
if (g_updater == nil) {
if (g_updater)
[g_updater release];
// Initialize the SQRLUpdater.
@try {
g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest];
@ -63,9 +65,6 @@ void AutoUpdater::SetFeedURL(const std::string& feed,
delegate->OnUpdateAvailable();
});
}];
} else {
g_updater.updateRequest = urlRequest;
}
}
// static