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;
|
||||
Request *r = network_http->downloadFileAsynchron(url, save,
|
||||
/*priority*/1,
|
||||
/*manage_mem*/false);
|
||||
/*manage_mem*/true);
|
||||
r->setAddonIconNotification(&addon);
|
||||
}
|
||||
else
|
||||
|
@ -156,7 +156,6 @@ void *NetworkHttp::mainLoop(void *obj)
|
||||
// so it is certain that even
|
||||
me->m_current_request = me->m_all_requests.getData().top();
|
||||
me->m_all_requests.getData().pop();
|
||||
me->m_all_requests.unlock();
|
||||
if(UserConfigParams::logAddons())
|
||||
{
|
||||
if(me->m_current_request->getCommand()==Request::HC_DOWNLOAD_FILE)
|
||||
@ -171,13 +170,12 @@ void *NetworkHttp::mainLoop(void *obj)
|
||||
}
|
||||
if(me->m_current_request->getCommand()==Request::HC_QUIT)
|
||||
{
|
||||
if(me->m_current_request->manageMemory())
|
||||
{
|
||||
delete me->m_current_request;
|
||||
me->m_current_request = NULL;
|
||||
}
|
||||
delete me->m_current_request;
|
||||
me->m_current_request = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
me->m_all_requests.unlock();
|
||||
CURLcode status=CURLE_OK;
|
||||
switch(me->m_current_request->getCommand())
|
||||
{
|
||||
@ -209,6 +207,17 @@ void *NetworkHttp::mainLoop(void *obj)
|
||||
if(UserConfigParams::logAddons())
|
||||
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);
|
||||
return 0;
|
||||
} // mainLoop
|
||||
|
Loading…
Reference in New Issue
Block a user