Skip to content

Commit c094bee

Browse files
authored
Segfault with client when using modern version of curl (#173)
curl_multi_cleanup appears to call back through its resources on cleanup now with a more modern version of the library, to pervent this from segfaulting the curl_multi_cleanup needs to happen before any of the libuv resources are destroyed in the ~client(). Closes #172
1 parent 05a1d42 commit c094bee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

examples/async_simple.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int main()
2222
{
2323
using namespace std::chrono_literals;
2424

25-
std::vector<std::string> urls = {"http://www.example.com", "http://www.google.com", "http://www.reddit.com"};
25+
std::vector<std::string> urls = {"http://www.example.com", "https://www.google.com", "http://www.reddit.com"};
2626

2727
lift::client client{};
2828

src/client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ client::~client()
145145
std::this_thread::sleep_for(1ms);
146146
}
147147

148+
curl_multi_cleanup(m_cmh);
149+
148150
// This breaks the main UV_RUN_DEFAULT loop.
149151
uv_stop(&m_uv_loop);
150152
// This tells the loop to cleanup all its resources.
@@ -161,7 +163,6 @@ client::~client()
161163
m_background_thread.join();
162164
m_executors.clear();
163165

164-
curl_multi_cleanup(m_cmh);
165166
global_cleanup();
166167
}
167168

0 commit comments

Comments
 (0)