[education/rkward] /: Circumvent race condition around detection of changed output
Thomas Friedrichsmeier
null at kde.org
Fri Oct 10 16:53:46 BST 2025
Git commit 8fe1503fd2d97175efe498e0bcb3a68c2a555169 by Thomas Friedrichsmeier.
Committed on 10/10/2025 at 15:50.
Pushed by tfry into branch 'master'.
Circumvent race condition around detection of changed output
See https://invent.kde.org/education/rkward/-/issues/49
Not entirely a fix for the underlying problem, but makes this
(non-fatal) condition very much less likely to trigger
M +1 -0 ChangeLog
M +1 -1 VERSION.cmake
M +1 -4 rkward/plugin/rkpreviewbox.cpp
M +1 -1 rkward/rbackend/rpackages/rkward/DESCRIPTION
M +12 -8 rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
https://invent.kde.org/education/rkward/-/commit/8fe1503fd2d97175efe498e0bcb3a68c2a555169
diff --git a/ChangeLog b/ChangeLog
index 7c199053d..39dc12aed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
--- Version 0.8.3 - UNRELEASED
+- Fixed: Output window would fail to open, automatically, for certain plugins
- Fixed: Width of "progress" dialogs (showing R output) would exceed screen size depending on configuration
--- Version 0.8.2 - Oct-01-2025
diff --git a/VERSION.cmake b/VERSION.cmake
index 03d965675..51713d0c9 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,3 +1,3 @@
# DO NOT CHANGE THIS FILE MANUALLY!
# It will be overwritten by scripts/set_dist_version.sh
-SET(RKVERSION_NUMBER 0.8.2z+0.8.3+devel1)
+SET(RKVERSION_NUMBER 0.8.2z+0.8.3+devel2)
diff --git a/rkward/plugin/rkpreviewbox.cpp b/rkward/plugin/rkpreviewbox.cpp
index 052264f5a..1295660c1 100644
--- a/rkward/plugin/rkpreviewbox.cpp
+++ b/rkward/plugin/rkpreviewbox.cpp
@@ -75,10 +75,7 @@ RKPreviewBox::RKPreviewBox(const QDomElement &element, RKComponent *parent_compo
"outfile <- tempfile (fileext='.html')\n"
"rk.assign.preview.data(") +
idprop + QStringLiteral(", list (filename=outfile, on.delete=function (id) {\n"
- " oldfile <- rk.get.output.html.file()\n"
- " rk.flush.output(outfile, ask=FALSE)\n"
- " unlink(outfile)\n"
- " rk.set.output.html.file(oldfile)\n"
+ " rkward:::.rk.discard.output(outfile)\n"
"}))\n"
"oldfile <- rk.set.output.html.file (outfile, style='preview') # for initialization\n"
"rk.set.output.html.file (oldfile)\n"
diff --git a/rkward/rbackend/rpackages/rkward/DESCRIPTION b/rkward/rbackend/rpackages/rkward/DESCRIPTION
index 2373701cf..9ba922832 100755
--- a/rkward/rbackend/rpackages/rkward/DESCRIPTION
+++ b/rkward/rbackend/rpackages/rkward/DESCRIPTION
@@ -15,7 +15,7 @@ LazyLoad: yes
Authors at R: c(person(given="Thomas", family="Friedrichsmeier", email="thomas.friedrichsmeier at kdemail.net", role=c("aut")), person(given="the RKWard", family="team",
email="rkward at kde.org", role=c("cre","aut")))
Version: 0.8.3
-Date: 2025-09-26
+Date: 2025-10-10
RoxygenNote: 7.3.3
Collate:
'base_overrides.R'
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
index e1eb50cf1..e15b8283c 100644
--- a/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
+++ b/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
@@ -256,15 +256,14 @@
files
}
-#' @export
-#' @rdname rk.get.tempfile.name
-"rk.flush.output" <- function (x=rk.get.output.html.file (), flush.images=TRUE, ask=TRUE, ...) {
- images <- character (0)
- if (flush.images) images <- .rk.get.images.in.html.file (x)
+# not exported, but used by interal preview code
+".rk.discard.output" <- function(x, flush.images=TRUE, ask=FALSE) {
+ images <- character(0)
+ if (flush.images) images <- .rk.get.images.in.html.file(x)
desc <- x
- if (length (images)) {
- desc <- paste (x, ", along with ", length (images), " image files", sep="")
+ if (length(images)) {
+ desc <- paste(x, ", along with ", length(images), " image files", sep="")
}
if (isTRUE (ask)) {
@@ -277,8 +276,13 @@
unlink (image)
}
)
+}
- rk.set.output.html.file (x, ...)
+#' @export
+#' @rdname rk.get.tempfile.name
+"rk.flush.output" <- function(x=rk.get.output.html.file(), flush.images=TRUE, ask=TRUE, ...) {
+ .rk.discard.output(x, flush.images, ask)
+ rk.set.output.html.file(x, ...)
}
#' Evaluate the given input file, recording a transcript to an HTML output file (including on-screen plots)
More information about the rkward-tracker
mailing list