Commit 35205d2f authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Fix startup crash on Windows (well, one of the two startup crashes...)

Silence cmake warnings.
parent edcc8b79
PROJECT(rkward)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) # As required by KF5
IF(NOT "${CMAKE_VERSION}" VERSION_LESS 3.3.0)
CMAKE_POLICY(SET CMP0063 OLD) # No symbol visibility in any of our static libraries needed
ENDIF()
IF(NOT CMAKE_VERBOSE_MAKEFILE)
SET (FORCE_PRETTY_MAKEFILE ON)
......
......@@ -32,6 +32,7 @@
#include <QLocalSocket>
#include <QDir>
#include <QStandardPaths>
#include <QTime>
#include "../version.h"
#include "../debug.h"
......@@ -120,7 +121,13 @@ void RKFrontendTransmitter::run () {
}
// fetch security token
if (!backend->canReadLine ()) backend->waitForReadyRead ();
{
// NOTE: On Qt5+Windows, readyReady may actually come in char by char, so calling waitForReadyRead() does not guaranteed we will
// see the full line, at all. But also, of course, we want to put some cap on trying. Using a time threshold for this.
QTime time;
time.start ();
while ((!backend->canReadLine ()) && (time.elapsed () < 3000)) backend->waitForReadyRead ();
}
token = QString::fromLocal8Bit (backend->readLine ()).trimmed ();
backend->closeReadChannel (QProcess::StandardError);
backend->closeReadChannel (QProcess::StandardOutput);
......@@ -140,6 +147,9 @@ void RKFrontendTransmitter::connectAndEnterLoop () {
QLocalSocket *con = server->nextPendingConnection ();
server->close ();
// NOTE: Not the same as setConnection(), below, but needed in case of transmission errors.
connection = con;
// handshake
if (!con->canReadLine ()) con->waitForReadyRead (1000);
QString token_c = QString::fromLocal8Bit (con->readLine ());
......
......@@ -308,7 +308,7 @@ int main (int argc, char *argv[]) {
for (int i = 0; i < call_args.length (); ++i) {
vbs << " " << call_args[i];
}
vbs << "\", 0\r\nSet WomScriptHost = Nothing\r\n";
vbs << "\", 0\r\nSet WinScriptHost = Nothing\r\n";
vbsf->close ();
QString filename = vbsf->fileName ();
delete (vbsf); // somehow, if creating vbsf on the stack, we cannot launch it, because "file is in use by another process", despite we have closed it.
......
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