[rkward/frameworks] rkward: Workaround for KRandom::random() initializing the random seed only for the first thread to call it.

Thomas Friedrichsmeier null at kde.org
Thu May 25 18:22:42 UTC 2017


Git commit 8f564127ff2f4556e3b48304e33241ba1284a856 by Thomas Friedrichsmeier.
Committed on 25/05/2017 at 18:22.
Pushed by tfry into branch 'frameworks'.

Workaround for KRandom::random() initializing the random seed only for the first thread to call it.

This would cause the main QLocalServer to listen on a fixed address.

M  +1    -1    rkward/main.cpp
M  +1    -1    rkward/rbackend/rkfrontendtransmitter.cpp

https://commits.kde.org/rkward/8f564127ff2f4556e3b48304e33241ba1284a856

diff --git a/rkward/main.cpp b/rkward/main.cpp
index 33f83517..96d77973 100644
--- a/rkward/main.cpp
+++ b/rkward/main.cpp
@@ -335,7 +335,7 @@ int main (int argc, char *argv[]) {
 	// TODO: Store somewhere else
 	qputenv ("R_BINARY", r_exe.toLocal8Bit ());
 
-
+	qsrand (QTime::currentTime ().msec ()); // Workaround for some versions of kcoreaddons (5.21.0 through at least 5.34.0). See https://phabricator.kde.org/D5966
 	if (app.isSessionRestored ()) {
 		RESTORE(RKWardMainWindow);	// well, whatever this is supposed to do -> TODO
 	} else {
diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index 4932d1d5..3ebdfc23 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -77,12 +77,12 @@ void RKFrontendTransmitter::run () {
 	RK_TRACE (RBACKEND);
 
 	// start server
+	qsrand (QTime::currentTime ().msec ()); // Workaround for some versions of kcoreaddons (5.21.0 through at least 5.34.0). See https://phabricator.kde.org/D5966
 	server = new QLocalServer (this);
 	// we add a bit of randomness to the servername, as in general the servername must be unique
 	// there could be conflicts with concurrent or with previous crashed rkward sessions.
 	if (!server->listen ("rkward" + KRandom::randomString (8))) handleTransmissionError ("Failure to start frontend server: " + server->errorString ());
 	connect (server, &QLocalServer::newConnection, this, &RKFrontendTransmitter::connectAndEnterLoop, Qt::QueuedConnection);
-
 	// start backend
 	backend = new QProcess (this);
 



More information about the rkward-tracker mailing list