Fixed another memory leak: stopping STK while icons are still downloading in the
background. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10000 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
879cbf99b1
commit
4026172cf6
@ -293,7 +293,7 @@ void AddonsManager::downloadIcons()
|
|||||||
std::string save = "icons/"+icon;
|
std::string save = "icons/"+icon;
|
||||||
Request *r = network_http->downloadFileAsynchron(url, save,
|
Request *r = network_http->downloadFileAsynchron(url, save,
|
||||||
/*priority*/1,
|
/*priority*/1,
|
||||||
/*manage_mem*/false);
|
/*manage_mem*/true);
|
||||||
r->setAddonIconNotification(&addon);
|
r->setAddonIconNotification(&addon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -156,7 +156,6 @@ void *NetworkHttp::mainLoop(void *obj)
|
|||||||
// so it is certain that even
|
// so it is certain that even
|
||||||
me->m_current_request = me->m_all_requests.getData().top();
|
me->m_current_request = me->m_all_requests.getData().top();
|
||||||
me->m_all_requests.getData().pop();
|
me->m_all_requests.getData().pop();
|
||||||
me->m_all_requests.unlock();
|
|
||||||
if(UserConfigParams::logAddons())
|
if(UserConfigParams::logAddons())
|
||||||
{
|
{
|
||||||
if(me->m_current_request->getCommand()==Request::HC_DOWNLOAD_FILE)
|
if(me->m_current_request->getCommand()==Request::HC_DOWNLOAD_FILE)
|
||||||
@ -170,14 +169,13 @@ void *NetworkHttp::mainLoop(void *obj)
|
|||||||
me->m_current_request->getPriority());
|
me->m_current_request->getPriority());
|
||||||
}
|
}
|
||||||
if(me->m_current_request->getCommand()==Request::HC_QUIT)
|
if(me->m_current_request->getCommand()==Request::HC_QUIT)
|
||||||
{
|
|
||||||
if(me->m_current_request->manageMemory())
|
|
||||||
{
|
{
|
||||||
delete me->m_current_request;
|
delete me->m_current_request;
|
||||||
me->m_current_request = NULL;
|
me->m_current_request = NULL;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me->m_all_requests.unlock();
|
||||||
CURLcode status=CURLE_OK;
|
CURLcode status=CURLE_OK;
|
||||||
switch(me->m_current_request->getCommand())
|
switch(me->m_current_request->getCommand())
|
||||||
{
|
{
|
||||||
@ -209,6 +207,17 @@ void *NetworkHttp::mainLoop(void *obj)
|
|||||||
if(UserConfigParams::logAddons())
|
if(UserConfigParams::logAddons())
|
||||||
printf("[addons] Network exiting.\n");
|
printf("[addons] Network exiting.\n");
|
||||||
|
|
||||||
|
// At this stage we have the lock for m_all_requests
|
||||||
|
while(!me->m_all_requests.getData().empty())
|
||||||
|
{
|
||||||
|
Request *r = me->m_all_requests.getData().top();
|
||||||
|
me->m_all_requests.getData().pop();
|
||||||
|
// Manage memory can be ignored here, all requests
|
||||||
|
// need to be freed.
|
||||||
|
delete r;
|
||||||
|
}
|
||||||
|
me->m_all_requests.unlock();
|
||||||
|
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
} // mainLoop
|
} // mainLoop
|
||||||
|
Loading…
Reference in New Issue
Block a user