QProcess: Destroyed while process ("C:\\Users\\admin\\Desktop\\test\\test_cases3\\GT_CF_Super3_V3_win.exe") is still running.
时间: 2023-08-27 20:21:04 浏览: 220
这个错误是由于在QProcess对象销毁之前,进程仍然在运行。在你提供的代码片段中,有两个地方可能导致这个错误。
首先,在MainWindow类的析构函数中,你尝试关闭和删除了m_process对象,但你没有等待进程完成。你可以使用waitForFinished函数来等待进程完成后再关闭和删除对象。你可以在delete之前加入如下代码:
```cpp
if (m_process)
{
m_process->waitForFinished();
m_process->close();
delete m_process;
}
```
其次,在UPreciseWindow类的析构函数中,你同样尝试关闭和删除了m_pProcess对象,但你没有等待进程完成。你可以在delete之前加入如下代码:
```cpp
m_pProcess->waitForFinished();
m_pProcess->close();
delete m_pProcess;
m_pProcess = nullptr;
```
通过这些修改,你就可以避免QProcess对象在进程仍在运行时被销毁的错误了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [QT QProcess: Destroyed while process (“apple.exe“) is still running](https://blog.csdn.net/guorong520/article/details/107636599)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [QProcess: Destroyed while process (“F:\\UPrecise1.5\\UPrecise.exe“) is still running.](https://blog.csdn.net/qq_33263769/article/details/129204381)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文