[core] use RAII-style lifetime tracking of Request objects

This commit is contained in:
Konstantin Käfer
2015-10-15 15:46:12 +02:00
parent 94a5ac857f
commit 096a3edf39
13 changed files with 57 additions and 56 deletions

View File

@@ -75,7 +75,6 @@ GlyphPBF::GlyphPBF(GlyphStore* store,
});
auto requestCallback = [this, store, fontStack, url](const Response &res) {
util::ThreadContext::getFileSource()->cancel(req);
req = nullptr;
if (res.status != Response::Successful) {
@@ -92,12 +91,7 @@ GlyphPBF::GlyphPBF(GlyphStore* store,
req = fs->request({ Resource::Kind::Glyphs, url }, util::RunLoop::getLoop(), requestCallback);
}
GlyphPBF::~GlyphPBF() {
if (req) {
util::ThreadContext::getFileSource()->cancel(req);
req = nullptr;
}
}
GlyphPBF::~GlyphPBF() = default;
void GlyphPBF::parse(GlyphStore* store, const std::string& fontStack, const std::string& url) {
if (data.empty()) {