[education/rkward] /: Also remove obsolete Windows RCleanup workaround

Thomas Friedrichsmeier null at kde.org
Thu Sep 4 20:46:54 BST 2025


Git commit 37db8d10ade3314f55af853a4251d9094a80eca3 by Thomas Friedrichsmeier.
Committed on 04/09/2025 at 16:19.
Pushed by tfry into branch 'master'.

Also remove obsolete Windows RCleanup workaround

M  +1    -0    ChangeLog
M  +5    -1    rkward/rbackend/FindR.cmake
M  +3    -10   rkward/rbackend/rkrbackend.cpp

https://invent.kde.org/education/rkward/-/commit/37db8d10ade3314f55af853a4251d9094a80eca3

diff --git a/ChangeLog b/ChangeLog
index 0a315d60b..3a7df1455 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.8.2 - UNRELEASED
+- Changed: R backend now uses UTF-8 mode on Windows
 - Added: options(error) may now be set freely (no longer needs to be .rk.do.error for correct behavior)
 - Fixed: Attached windows would not always be placed in the most recently active pane (in a split view)
 - Fixed: Crash when switching from dialog to wizard interface in plugins providing a preview
diff --git a/rkward/rbackend/FindR.cmake b/rkward/rbackend/FindR.cmake
index dac9413e9..2ca48c432 100644
--- a/rkward/rbackend/FindR.cmake
+++ b/rkward/rbackend/FindR.cmake
@@ -29,7 +29,11 @@ IF(NOT NO_CHECK_R)
     MESSAGE (STATUS "R architecture is ${R_ARCH}")
 
     # check R version.
-    SET (R_MIN_VERSION "3.4.4")
+    IF(WIN32)
+      SET(R_MIN_VERSION "4.2.0")
+    ELSE()
+      SET(R_MIN_VERSION "3.4.4")
+    ENDIF()
     MESSAGE (STATUS "Checking R version")
     EXECUTE_PROCESS(
         COMMAND ${R_EXECUTABLE} "--slave" "--no-save" "--no-init-file" "-e" "cat (paste(R.version$major, R.version$minor, sep='.'))"
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index 573be4e9b..74ee77cf5 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -232,12 +232,6 @@ int RReadConsole(const char *prompt, unsigned char *buf, int buflen, int hist) {
 				RCommandProxy *command = RKRBackend::this_pointer->fetchNextCommand();
 				if (!command) {
 					RK_DEBUG(RBACKEND, DL_DEBUG, "returning from REPL");
-#ifdef Q_OS_WIN
-					// Can't easily override R_CleanUp on Windows, so we're calling it manually, here, then force exit
-					if (RKRBackend::this_pointer->killed == RKRBackend::ExitNow) RCleanUp(SA_NOSAVE, 0, 0);
-					else RCleanUp(SA_SUICIDE, 1, 0);
-					exit(0);
-#endif
 					return 0; // jumps out of the event loop!
 				}
 
@@ -783,10 +777,10 @@ void RKRBackend::setupCallbacks() {
 	RK_R_Params.YesNoCancel = RAskYesNoCancel;
 	RK_R_Params.Busy = RBusy;
 	RK_R_Params.ResetConsole = RResetConsole;
+	RK_R_Params.CleanUp = RCleanUp; // unfortunately, it seems, we can't safely cancel quitting anymore, here!
+	RK_R_Params.Suicide = RSuicide;
 
-	// TODO: callback mechanism(s) for ChosseFile, ShowFiles, EditFiles
-	// TODO: also for RSuicide (Less important, obviously, since this should not be triggered, in normal operation).
-	// NOTE: For RCleanUp see RReadConsole RCleanup?
+	// TODO: callback mechanism(s) for ChosseFile, ShowFiles, EditFiles still not available on Windows?
 
 	RK_R_Params.R_Quiet = Rboolean::FALSE;
 	RK_R_Params.R_Interactive = Rboolean::TRUE;
@@ -814,7 +808,6 @@ void RKRBackend::connectCallbacks() {
 	// connect R standard callback to our own functions. Important: Don't do so, before our own versions are ready to be used!
 	ROb(R_Outputfile) = nullptr;
 	ROb(R_Consolefile) = nullptr;
-	ROb(ptr_R_Suicide) = RSuicide;
 	ROb(ptr_R_ShowMessage) = RShowMessage; // rarely used in R on unix
 	ROb(ptr_R_ReadConsole) = RReadConsole;
 	ROb(ptr_R_WriteConsoleEx) = RWriteConsoleEx;



More information about the rkward-tracker mailing list