[rkward/frameworks] rkward/rbackend: Fix initialization bug.

Thomas Friedrichsmeier null at kde.org
Fri May 19 11:18:16 UTC 2017


Git commit 1945fa6dee4013c59b3dc32cbd9defc9db33f080 by Thomas Friedrichsmeier.
Committed on 19/05/2017 at 11:18.
Pushed by tfry into branch 'frameworks'.

Fix initialization bug.

M  +6    -6    rkward/rbackend/rkrbackend.cpp

https://commits.kde.org/rkward/1945fa6dee4013c59b3dc32cbd9defc9db33f080

diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index ce5bab98..a30a7bd3 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -750,6 +750,9 @@ SEXP doUpdateLocale ();
 RKRBackend::RKRBackend () : stdout_stderr_mutex (QMutex::Recursive) {
 	RK_TRACE (RBACKEND);
 
+	RK_ASSERT (this_pointer == 0);
+	this_pointer = this;
+
 	current_locale_encoder = 0; // marks locale as not yet initialized
 	doUpdateLocale ();
 	r_running = false;
@@ -757,9 +760,6 @@ RKRBackend::RKRBackend () : stdout_stderr_mutex (QMutex::Recursive) {
 	current_command = 0;
 	pending_priority_command = 0;
 	stdout_stderr_fd = -1;
-
-	RK_ASSERT (this_pointer == 0);
-	this_pointer = this;
 }
 
 #ifdef Q_OS_WIN
@@ -920,10 +920,10 @@ SEXP doUpdateLocale () {
 		delete (RKRBackend::this_pointer->current_locale_encoder);
 		delete (RKRBackend::this_pointer->current_locale_decoder);
 		QTextCodec::setCodecForLocale (0);
-		RK_ASSERT (QTextCodec::codecForLocale ());
-		RKRBackend::this_pointer->current_locale_encoder = QTextCodec::codecForLocale ()->makeEncoder (QTextCodec::DefaultConversion);  // NOTE: shall pass non-representable characters unmodified, rather than stripping them.
-		RKRBackend::this_pointer->current_locale_decoder = QTextCodec::codecForLocale ()->makeDecoder (QTextCodec::DefaultConversion);
 	}
+	RK_ASSERT (QTextCodec::codecForLocale ());
+	RKRBackend::this_pointer->current_locale_encoder = QTextCodec::codecForLocale ()->makeEncoder (QTextCodec::DefaultConversion);  // NOTE: shall pass non-representable characters unmodified, rather than stripping them.
+	RKRBackend::this_pointer->current_locale_decoder = QTextCodec::codecForLocale ()->makeDecoder (QTextCodec::DefaultConversion);
 	RK_DEBUG (RBACKEND, DL_WARNING, "New locale codec is %s", QTextCodec::codecForLocale ()->name ().data ());
 
 	return R_NilValue;



More information about the rkward-tracker mailing list