mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Satisfy strange Qt thread-ownership requirements around QProcess objects
This commit is contained in:
@@ -110,6 +110,8 @@ static ShaderToolOutput RunTool(const ShaderProcessingTool &tool, QWidget *windo
|
||||
QByteArray stdout_data;
|
||||
QProcess process;
|
||||
|
||||
QThread *mainThread = QThread::currentThread();
|
||||
|
||||
LambdaThread *thread = new LambdaThread([&]() {
|
||||
if(readStdin)
|
||||
process.setStandardInputFile(input_file);
|
||||
@@ -151,7 +153,12 @@ static ShaderToolOutput RunTool(const ShaderProcessingTool &tool, QWidget *windo
|
||||
// QFile::remove(input_file);
|
||||
QFile::remove(output_file);
|
||||
QFile::remove(stdout_file);
|
||||
|
||||
process.moveToThread(mainThread);
|
||||
});
|
||||
|
||||
thread->moveObjectToThread(&process);
|
||||
|
||||
thread->start();
|
||||
|
||||
ShowProgressDialog(window, QApplication::translate("ShaderProcessingTool",
|
||||
|
||||
@@ -305,6 +305,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void moveObjectToThread(QObject *o) { o->moveToThread(m_Thread); }
|
||||
bool isCurrentThread() { return QThread::currentThread() == m_Thread; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user