[education/rkward/releases/0.7.2] /: Add dummies for the new R graphics functions to avoid crash.

Thomas Friedrichsmeier null at kde.org
Sun Jun 27 08:15:18 BST 2021


Git commit 157207b915647cd8600c616cf6dfed8f83ecff30 by Thomas Friedrichsmeier.
Committed on 27/06/2021 at 07:14.
Pushed by tfry into branch 'releases/0.7.2'.

Add dummies for the new R graphics functions to avoid crash.

This is not a proper implementation, yet.

CCBUG: https://bugs.kde.org/show_bug.cgi?id=438993

M  +3    -0    ChangeLog
M  +14   -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
M  +36   -0    rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp

https://invent.kde.org/education/rkward/commit/157207b915647cd8600c616cf6dfed8f83ecff30

diff --git a/ChangeLog b/ChangeLog
index 0210df6e..ae17bc62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+--- Version 0.7.2b - UNRELEASED
+- Fixed: Crash when attempting to use new graphics features in R 4.1.0 (esp. plotting using ggplot2)
+
 --- Version 0.7.2 - Oct-16-2020
 - Script preview keeps vertical scroll position when updating
 - Python development scripts have been ported to python3
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
index 9909639f..e215c090 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
@@ -216,6 +216,19 @@ bool RKGraphicsDeviceDesc::init (pDevDesc dev, double pointsize, const QStringLi
 #endif
 	dev->newFrameConfirm = RKD_NewFrameConfirm;
 
+#if R_VERSION >= R_Version (2, 14, 0)
+	dev->holdflush = RKD_HoldFlush;
+#endif
+
+#if R_VERSION >= R_Version (4, 1, 0)
+	dev->setPattern = RKD_SetPattern;
+	dev->releasePattern = RKD_ReleasePattern;
+	dev->setClipPath = RKD_SetClipPath;
+	dev->releaseClipPath = RKD_ReleaseClipPath;
+	dev->setMask = RKD_SetMask;
+	dev->releaseMask = RKD_ReleaseMask;
+	dev->deviceVersion = 14;
+	dev->deviceClip = FALSE; // for now
+#endif
 	return true;
 }
- 
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
index 716a9511..b7be1609 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
@@ -579,5 +579,41 @@ void RKD_onExit (pDevDesc dev) {
 	}
 	dev->gettingEvent = (Rboolean) false;
 }
+#endif
+
+#if R_VERSION >= R_Version (2, 14, 0)
+int RKD_HoldFlush (pDevDesc dev, int level) {
+#warning implement me
+	return 0;
+}
+#endif
+
+#if R_VERSION >= R_Version (4, 1, 0)
+SEXP RKD_SetPattern (SEXP pattern, pDevDesc dd) {
+#warning implement me
+	return R_NilValue;
+}
+
+void RKD_ReleasePattern (SEXP ref, pDevDesc dd) {
+#warning implement me
+}
+
+SEXP RKD_SetClipPath (SEXP path, SEXP ref, pDevDesc dd) {
+#warning implement me
+	return R_NilValue;
+}
+
+void RKD_ReleaseClipPath (SEXP ref, pDevDesc dd) {
+#warning implement me
+}
+
+SEXP RKD_SetMask (SEXP path, SEXP ref, pDevDesc dd) {
+#warning implement me
+	return R_NilValue;
+}
+
+void RKD_ReleaseMask (SEXP ref, pDevDesc dd) {
+#warning implement me
+}
 
 #endif


More information about the rkward-tracker mailing list