Beispiel #1
0
CurlDownload::~CurlDownload()
{
    if (m_downloadManager.isActive(m_curlHandle))
        cancel();

    // We have to wait for the download thread to release us.
    // Otherwise the memory for this object could be freed while
    // the thread still tries to access it. It has to be done outside
    // this object's mutex to avoid a deadlock.
    while (m_downloadManager.isActive(m_curlHandle))
        usleep(500);

    MutexLocker locker(m_mutex);

    if (m_url)
        fastFree(m_url);

    if (m_customHeaders)
        curl_slist_free_all(m_customHeaders);

    if (!m_finished) {
        closeFile();
        moveFileToDestination();
    }
}
void CurlDownload::didFinish()
{
    closeFile();
    moveFileToDestination();

    if (m_listener)
        m_listener->didFinish();
}
Beispiel #3
0
void CurlDownload::didFinish()
{
    MutexLocker locker(m_mutex);

    closeFile();
    moveFileToDestination();
    m_finished = true;

    if (m_listener)
        m_listener->didFinish();
}
CurlDownload::~CurlDownload()
{
    MutexLocker locker(m_mutex);

    if (m_url)
        fastFree(m_url);

    if (m_customHeaders)
        curl_slist_free_all(m_customHeaders);

    closeFile();
    moveFileToDestination();
}