cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: segfault after curl_easy_cleanup via progress callback

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Aug 2011 13:42:53 +0200 (CEST)

On Wed, 10 Aug 2011, Dave Reisner wrote:

> The documentation for curl_easy_cleanup states that further calls to the
> handle are invalid after this call so I'm a bit confused as to why curl
> would be hitting the progress callback at this point.

It is probably a matter of fixing the wording in the documentation.

curl_easy_cleanup() may in fact cause callbacks to get called. This is for
example likely to happen if you use other protocols than HTTP/HTTPS when
libcurl decides to shut down the connection as then it'll send one or more
final commands to the server (and read the responses) - some of which may
cause callbacks to get called.

The mention that the handle is invalid is true, but I've always meant that to
mean:

  "after curl_easy_cleanup() returns, the handle is invalidated"

During the callbacks that might be called from within curl_easy_cleanup(), the
handle is still valid.

I hope this clears it up a bit. I'll try to update the curl_easy_cleanup()
documentation to make this less foggy...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-11