No free json string

This commit is contained in:
Krad
2021-10-26 13:07:54 +08:00
parent 8d43caed5f
commit 43442b319f

View File

@@ -56,7 +56,9 @@ void DeviceManager::initDevice() {
connect(EventCenter::Default(),&EventCenter::RequestEmptyScan,[=](QObject* sender, QObject* detail){ connect(EventCenter::Default(),&EventCenter::RequestEmptyScan,[=](QObject* sender, QObject* detail){
std::string json= getJsonFromPatInf(detail); std::string json= getJsonFromPatInf(detail);
qDebug()<<json.c_str(); qDebug()<<json.c_str();
processScan(json.c_str(), true); void * jss = malloc(json.size());
memcpy(jss,json.c_str(),json.size());
processScan((char*)jss,true);
}); });
// Patient scan // Patient scan
connect(EventCenter::Default(),&EventCenter::RequestPatientScan,[=](QObject* sender, QObject* detail){ connect(EventCenter::Default(),&EventCenter::RequestPatientScan,[=](QObject* sender, QObject* detail){
@@ -64,7 +66,9 @@ void DeviceManager::initDevice() {
qDebug()<<json.c_str(); qDebug()<<json.c_str();
if (!json.empty()) if (!json.empty())
{ {
processScan(json.c_str()); void * jss = malloc(json.size());
memcpy(jss,json.c_str(),json.size());
processScan((char*)jss);
} }
}); });
// stop // stop