[education/rkward] /: Fix crash when renaming toplevel object from context menu

Thomas Friedrichsmeier null at kde.org
Thu Oct 27 16:28:41 BST 2022


Git commit e1c9ca48b5b1554acc2644baefcbc9d5b20362db by Thomas Friedrichsmeier.
Committed on 27/10/2022 at 15:28.
Pushed by tfry into branch 'master'.

Fix crash when renaming toplevel object from context menu

M  +2    -0    ChangeLog
M  +1    -0    rkward/core/robject.cpp

https://invent.kde.org/education/rkward/commit/e1c9ca48b5b1554acc2644baefcbc9d5b20362db

diff --git a/ChangeLog b/ChangeLog
index f1e6995b..f9a8561a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+-- Fixed: Crash when renaming top level object from context menu
+
 --- Version 0.7.5 - Oct-24-2022
 - Fixed: Backend failed to start when installed in a path with spaces on Windows volumes without 8.3 support
 - Fixed: Trying to restart backend could cause a hang, on Windows
diff --git a/rkward/core/robject.cpp b/rkward/core/robject.cpp
index 060cfa2d..2b5a4f8f 100644
--- a/rkward/core/robject.cpp
+++ b/rkward/core/robject.cpp
@@ -840,6 +840,7 @@ REnvironmentObject* RObject::toplevelEnvironment () const {
 RObject *RObject::globalEnvSymbol() const {
 	RK_TRACE (OBJECTS);
 	RObject *o = const_cast<RObject*>(this);	// it's ok, all we need to do is find the toplevel parent
+	if (o == RObjectList::getGlobalEnv()) return o;
 	while (o->parent) {
 		if (o->parent == RObjectList::getGlobalEnv()) return o;
 		o = o->parent;


More information about the rkward-tracker mailing list