Fixed another memory leak if a download request is aborted.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9999 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -101,6 +101,9 @@ public:
|
||||
/** Returns if this request is to be cancelled. */
|
||||
bool isCancelled() const { return m_cancel; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Specifies if the memory should be managed by network_http. */
|
||||
void setManageMemory(bool m) { m_manage_memory = m; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the memory for this object should be managed by
|
||||
* by network_http (i.e. freed once the request is handled). */
|
||||
bool manageMemory() const { return m_manage_memory; }
|
||||
|
||||
@@ -180,6 +180,11 @@ GUIEngine::EventPropagation
|
||||
if(m_download_request)
|
||||
{
|
||||
assert(m_download_request);
|
||||
// In case of a cancel we can't free the memory, since
|
||||
// network_http will potentially update the request. So in
|
||||
// order to avoid a memory leak, we let network_http free
|
||||
// the request.
|
||||
m_download_request->setManageMemory(true);
|
||||
m_download_request->cancel();
|
||||
}
|
||||
dismiss();
|
||||
|
||||
Reference in New Issue
Block a user