Changeset 152297 in webkit
- Timestamp:
- Jul 2, 2013 9:26:03 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152293 r152297 1 2013-07-02 peavo@outlook.com <peavo@outlook.com> 2 3 [Curl] Crash after download. 4 https://bugs.webkit.org/show_bug.cgi?id=118303 5 6 Reviewed by Brent Fulgham. 7 8 We need to make sure that the Curl easy handle is removed from the Curl multi handle before it's freed. 9 10 * platform/network/curl/CurlDownload.cpp: 11 (CurlDownloadManager::updateHandleList): Use addToCurl() and removeFromCurl() methods. 12 (CurlDownloadManager::addToCurl): Add method to add easy handle to multi handle. 13 (CurlDownloadManager::removeFromCurl): Add method to remove easy handle from multi handle, and then delete the handle. 14 (CurlDownloadManager::downloadThread): Use removeFromCurl() method. 15 (CurlDownload::~CurlDownload): 16 * platform/network/curl/CurlDownload.h: Avoid deleting Curl easy handle in destructor. 17 1 18 2013-07-02 Radu Stavila <stavila@adobe.com> 2 19 -
trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp
r152142 r152297 122 122 int size = m_pendingHandleList.size(); 123 123 for (int i = 0; i < size; i++) { 124 CURLMcode retval = curl_multi_add_handle(m_curlMultiHandle, m_pendingHandleList[0]); 125 126 if (retval == CURLM_OK) 124 if (addToCurl(m_pendingHandleList[0])) 127 125 m_pendingHandleList.remove(0); 128 126 } … … 131 129 size = m_removedHandleList.size(); 132 130 for (int i = 0; i < size; i++) { 133 CURLMcode retval = curl_multi_remove_handle(m_curlMultiHandle, m_removedHandleList[0]); 134 135 if (retval == CURLM_OK) 131 if (removeFromCurl(m_removedHandleList[0])) 136 132 m_removedHandleList.remove(0); 137 133 } 134 } 135 136 bool CurlDownloadManager::addToCurl(CURL* curlHandle) 137 { 138 CURLMcode retval = curl_multi_add_handle(m_curlMultiHandle, curlHandle); 139 return retval == CURLM_OK; 140 } 141 142 bool CurlDownloadManager::removeFromCurl(CURL* curlHandle) 143 { 144 CURLMcode retval = curl_multi_remove_handle(m_curlMultiHandle, curlHandle); 145 if (retval == CURLM_OK) { 146 curl_easy_cleanup(curlHandle); 147 return true; 148 } 149 return false; 138 150 } 139 151 … … 189 201 callOnMainThread<CurlDownload*, CurlDownload*>(CurlDownload::downloadFailedCallback, download); 190 202 191 curl_multi_remove_handle(downloadManager->getMultiHandle(),msg->easy_handle);203 downloadManager->removeFromCurl(msg->easy_handle); 192 204 } 193 205 … … 212 224 { 213 225 MutexLocker locker(m_mutex); 214 215 if (m_curlHandle)216 curl_easy_cleanup(m_curlHandle);217 226 218 227 if (m_url) -
trunk/Source/WebCore/platform/network/curl/CurlDownload.h
r151067 r152297 59 59 bool runThread() const { return m_runThread; } 60 60 void setRunThread(bool runThread) { m_runThread = runThread; } 61 62 bool addToCurl(CURL* curlHandle); 63 bool removeFromCurl(CURL* curlHandle); 61 64 62 65 static void downloadThread(void* data);
Note: See TracChangeset
for help on using the changeset viewer.