Merge branch 'master' into pu/mp

This commit is contained in:
Jacek Jendrzej
2017-10-09 16:40:11 +02:00

View File

@@ -295,15 +295,13 @@ bool CUpnpBrowserGui::getResults(std::string id, unsigned int start, unsigned in
std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result) std::vector<UPnPEntry> *CUpnpBrowserGui::decodeResult(std::string result)
{ {
xmlNodePtr root, node, snode; xmlNodePtr root, node, snode;
std::vector<UPnPEntry> *entries;
xmlDocPtr parser = parseXml(result.c_str(),"UTF-8"); xmlDocPtr parser = parseXml(result.c_str(),"UTF-8");
root = xmlDocGetRootElement(parser); root = xmlDocGetRootElement(parser);
if (!root) { if (!root) {
xmlFreeDoc(parser); xmlFreeDoc(parser);
return NULL; return NULL;
} }
entries = new std::vector<UPnPEntry>; std::vector<UPnPEntry> *entries = new std::vector<UPnPEntry>;
for (node=xmlChildrenNode(root); node; node=xmlNextNode(node)) for (node=xmlChildrenNode(root); node; node=xmlNextNode(node))
{ {
@@ -643,9 +641,18 @@ void CUpnpBrowserGui::playnext(void)
timeout = time(NULL) + g_settings.picviewer_slide_time; timeout = time(NULL) + g_settings.picviewer_slide_time;
showPicture((*entries)[0].resources[preferred].url); showPicture((*entries)[0].resources[preferred].url);
} }
delete entries;
entries = NULL;
return; return;
}else{
delete entries;
entries = NULL;
} }
} else { } else {
if(entries){
delete entries;
entries = NULL;
}
neutrino_msg_t msg; neutrino_msg_t msg;
neutrino_msg_data_t data; neutrino_msg_data_t data;
g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display
@@ -657,7 +664,10 @@ void CUpnpBrowserGui::playnext(void)
} }
} }
} }
if(entries){
delete entries; delete entries;
entries = NULL;
}
m_frameBuffer->Clear(); m_frameBuffer->Clear();
} }
@@ -689,9 +699,13 @@ bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector<U
rfound=true; rfound=true;
} }
} }
if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0) if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0){
if(entries){
delete entries;
entries = NULL;
}
return false; return false;
}
return true; return true;
} }
@@ -922,6 +936,7 @@ bool CUpnpBrowserGui::selectItem(std::string id)
#endif #endif
delete entries; delete entries;
entries = NULL;
timeout = 0; timeout = 0;
return endall; return endall;