reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit a2b0c114d7687f1d1acc8a313aad901f4dc86fda
parent bbda91c48eed757c9531db6a2fa9658caf8f1b1e
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 14 Jan 2016 12:43:29 -0800

initialize and cleanup curl's global state in the main thread

Diffstat:
Msrc/download.cpp | 10++++++++++
Msrc/download.hpp | 3+++
Msrc/reapack.cpp | 4++++
3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/download.cpp b/src/download.cpp @@ -30,6 +30,16 @@ size_t Download::s_running = 0; static const int DOWNLOAD_TIMEOUT = 5; static const int CONCURRENT_DOWNLOADS = 3; +void Download::Init() +{ + curl_global_init(CURL_GLOBAL_DEFAULT); +} + +void Download::Cleanup() +{ + curl_global_cleanup(); +} + Download::Download(const string &name, const string &url) : m_name(name), m_url(url), m_threadHandle(nullptr) { diff --git a/src/download.hpp b/src/download.hpp @@ -33,6 +33,9 @@ public: typedef boost::signals2::signal<void ()> Signal; typedef Signal::slot_type Callback; + static void Init(); + static void Cleanup(); + Download(const std::string &name, const std::string &url); ~Download(); diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -44,6 +44,8 @@ void ReaPack::init(REAPER_PLUGIN_HINSTANCE instance, reaper_plugin_info_t *rec) m_progress = Dialog::Create<Progress>(m_instance, m_mainWindow); m_manager = Dialog::Create<Manager>(m_instance, m_mainWindow, this); + + Download::Init(); } void ReaPack::cleanup() @@ -55,6 +57,8 @@ void ReaPack::cleanup() Dialog::Destroy(m_progress); Dialog::Destroy(m_manager); + + Download::Cleanup(); } int ReaPack::setupAction(const char *name, const ActionCallback &callback)