QT中槽函数创建进程后,多次创建后导致qt的主进程异常退出
毕业设计
1
问题遇到的现象和发生背景
这个问题不是直接创建进程退出后就显示出来,而是在创建了好几次后然后报错
问题相关代码
void UploadSlot::onClick() {
/*
wchar_t* nowComm = (wchar_t*)malloc(sizeof(wchar_t)*(12 + wcslen(selfNode->FilePath)+2));
wcscpy(nowComm, L"python pySrc/getData.py");
wcscat(nowComm, selfNode->FilePath);
//进行上传
selfNode->uploadStat = 1;
selfNode->orderStat = 1;
*/
selfBut->setEnabled(FALSE);
/*
((QLabel*)(tableWeightValueP[selfIndex][UPLOAD_STAT_INDEX]))->\
setText(*selfUploadTrue);
((QLabel*)(tableWeightValueP[selfIndex][ORDER_STAT_INDEX]))->\
setText(*selfOrderTrue);
*/
selfUpLoadStat->setText(*selfOrderTrue);
selfOrderStat->setText(*selfUploadTrue);
QString fileNameQ = selfFoundWeight->text();
wchar_t fileNameW[200];
memset(fileNameW, 0x00, sizeof(wchar_t) * 200);
fileNameQ.toWCharArray(fileNameW);
//进行上传
wchar_t* nowComm = (wchar_t*)malloc(sizeof(wchar_t)*(12 + wcslen(selfPath) + wcslen(fileNameW) + 8));
wcscpy(nowComm, L"python pySrc/getData.py ");
wcscat(nowComm, selfPath);
wcscat(nowComm, L"\\");
wcscat(nowComm, fileNameW);
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
CreateProcess(NULL, nowComm, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
//QProcess* a = new QProcess();
//a->start(QString::fromWCharArray(nowComm));
//system(nowComm);
};
运行结果及报错内容
发表回复