Commit 011f2f98 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner.NodeInstances: Better approach for process handling

Don't wait anymore that processes have finished. Simply connect the
finished signal to deleteLater().
parent 14a5d575
...@@ -61,7 +61,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV ...@@ -61,7 +61,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
#endif #endif
applicationPath += "/qmlpuppet"; applicationPath += "/qmlpuppet";
m_qmlPuppetEditorProcess = new QProcess(this); m_qmlPuppetEditorProcess = new QProcess;
connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill())); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill()));
bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty(); bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty();
...@@ -70,7 +70,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV ...@@ -70,7 +70,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster"); m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster");
if (runModus == NormalModus) { if (runModus == NormalModus) {
m_qmlPuppetPreviewProcess = new QProcess(this); m_qmlPuppetPreviewProcess = new QProcess;
connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill())); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill()));
if (fowardQmlpuppetOutput) if (fowardQmlpuppetOutput)
...@@ -82,8 +82,11 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV ...@@ -82,8 +82,11 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
m_qmlPuppetEditorProcess->waitForStarted(); m_qmlPuppetEditorProcess->waitForStarted();
connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int)), m_qmlPuppetEditorProcess.data(),SLOT(deleteLater()));
if (runModus == NormalModus) { if (runModus == NormalModus) {
m_qmlPuppetPreviewProcess->waitForStarted(); m_qmlPuppetPreviewProcess->waitForStarted();
connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int)), m_qmlPuppetPreviewProcess.data(),SLOT(deleteLater()));
} }
if (!m_localServer->hasPendingConnections()) if (!m_localServer->hasPendingConnections())
...@@ -105,6 +108,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV ...@@ -105,6 +108,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
NodeInstanceServerProxy::~NodeInstanceServerProxy() NodeInstanceServerProxy::~NodeInstanceServerProxy()
{ {
disconnect(this, SLOT(processFinished(int,QProcess::ExitStatus)));
if (m_firstSocket) if (m_firstSocket)
m_firstSocket->close(); m_firstSocket->close();
...@@ -112,21 +117,11 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy() ...@@ -112,21 +117,11 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy()
m_secondSocket->close(); m_secondSocket->close();
if (m_qmlPuppetEditorProcess) { if (m_qmlPuppetEditorProcess)
m_qmlPuppetEditorProcess->blockSignals(true);
m_qmlPuppetEditorProcess->kill(); m_qmlPuppetEditorProcess->kill();
}
if (m_qmlPuppetPreviewProcess) { if (m_qmlPuppetPreviewProcess)
m_qmlPuppetPreviewProcess->blockSignals(true);
m_qmlPuppetPreviewProcess->kill(); m_qmlPuppetPreviewProcess->kill();
}
if (m_qmlPuppetEditorProcess && m_qmlPuppetEditorProcess->state() != QProcess::NotRunning)
m_qmlPuppetEditorProcess->waitForFinished(1000);
if (m_qmlPuppetPreviewProcess && m_qmlPuppetPreviewProcess->state() != QProcess::NotRunning)
m_qmlPuppetPreviewProcess->waitForFinished(1000);
} }
void NodeInstanceServerProxy::dispatchCommand(const QVariant &command) void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment