Skip to content
Snippets Groups Projects
Verified Commit ff502f30 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Initialize client lazily

This prevents a use after free in the coeurl logging, if we exit immediately.
parent bf68aa28
No related branches found
No related tags found
No related merge requests found
......@@ -28,22 +28,20 @@ Q_DECLARE_METATYPE(std::vector<std::string>)
Q_DECLARE_METATYPE(std::vector<QString>)
Q_DECLARE_METATYPE(std::set<QString>)
namespace {
auto client_ = std::make_shared<mtx::http::Client>();
}
namespace http {
mtx::http::Client *
client()
{
static auto client_ = std::make_shared<mtx::http::Client>();
return client_.get();
}
bool
is_logged_in()
{
return !client_->access_token().empty();
return !client()->access_token().empty();
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment