Commit e8df47d8 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Give backend thread a chance to shutdown properly.

Should fix the "QProcess: Destroyed while process still running" warning.
parent dbb07612
......@@ -118,10 +118,10 @@ void RKFrontendTransmitter::run () {
if (!debugger.isEmpty ()) {
args = debugger.split (' ') + args;
}
for (int i = 0; i < args.size (); ++i) {
qDebug ("%s", qPrintable (args[i]));
}
qDebug ("%s", qPrintable (qgetenv ("R_BINARY")));
if (DL_DEBUG >= RK_Debug_Level) {
qDebug ("%s", qPrintable (args.join ("\n")));
qDebug ("%s", qPrintable (qgetenv ("R_BINARY")));
}
backend->start (qgetenv ("R_BINARY"), args, QIODevice::ReadOnly);
if (!backend->waitForStarted ()) {
......@@ -142,6 +142,8 @@ qDebug ("%s", qPrintable (qgetenv ("R_BINARY")));
exec ();
backend->waitForFinished ();
if (!connection) {
RK_ASSERT (false);
return;
......
......@@ -39,8 +39,9 @@ RKRBackendProtocolFrontend::~RKRBackendProtocolFrontend () {
RK_TRACE (RBACKEND);
terminateBackend ();
RKFrontendTransmitter::instance ()->quit ();
RKFrontendTransmitter::instance ()->wait (1000);
RKFrontendTransmitter::instance ()->wait (1000); // Wait for thread to catch the backend's exit request, and exit()
RKFrontendTransmitter::instance ()->quit (); // Tell it to quit, otherwise
RKFrontendTransmitter::instance ()->wait (1000); // Wait for thread to quit and clean up.
delete RKFrontendTransmitter::instance ();
}
......
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