[education/rkward] /: Remove RKGlobals::tracker() in favor of RKModificationTracker::instance()

Thomas Friedrichsmeier null at kde.org
Thu Apr 14 22:14:06 BST 2022


Git commit 4dd1614c67ec861258bb66fbb3c6017451a69348 by Thomas Friedrichsmeier.
Committed on 13/04/2022 at 20:12.
Pushed by tfry into branch 'master'.

Remove RKGlobals::tracker() in favor of RKModificationTracker::instance()

M  +9    -9    rkward/core/rcontainerobject.cpp
M  +3    -3    rkward/core/renvironmentobject.cpp
M  +1    -1    rkward/core/rfunctionobject.cpp
M  +6    -3    rkward/core/rkmodificationtracker.cpp
M  +2    -0    rkward/core/rkmodificationtracker.h
M  +3    -3    rkward/core/rkpseudoobjects.cpp
M  +1    -1    rkward/core/rkrownames.cpp
M  +7    -7    rkward/core/rkvariable.cpp
M  +9    -9    rkward/core/robject.cpp
M  +5    -5    rkward/core/robjectlist.cpp
M  +2    -2    rkward/dataeditor/rkvareditmodel.cpp
M  +4    -4    rkward/misc/rkobjectlistview.cpp
M  +0    -1    rkward/rkglobals.cpp
M  +0    -6    rkward/rkglobals.h
M  +3    -4    rkward/rkward.cpp
M  +2    -2    rkward/windows/robjectbrowser.cpp
M  +1    -1    tests/analysis_plugins/linear_regression.rkcommands.R

https://invent.kde.org/education/rkward/commit/4dd1614c67ec861258bb66fbb3c6017451a69348

diff --git a/rkward/core/rcontainerobject.cpp b/rkward/core/rcontainerobject.cpp
index fc444348..e851d731 100644
--- a/rkward/core/rcontainerobject.cpp
+++ b/rkward/core/rcontainerobject.cpp
@@ -51,7 +51,7 @@ RObject *RContainerObject::updateChildStructure (RObject *child, RData *new_data
 		} else {
 			int child_index = childmap.indexOf (child);
 			RK_ASSERT (child_index >= 0);
-			if (RKGlobals::tracker ()->removeObject (child, 0, true)) {
+			if (RKModificationTracker::instance()->removeObject (child, 0, true)) {
 				RData *child_name_data = new_data->structureVector ().at (StoragePositionName);
 				RK_ASSERT (child_name_data->getDataType () == RData::StringVector);
 				RK_ASSERT (child_name_data->getDataLength () >= 1);
@@ -112,17 +112,17 @@ RObject *RContainerObject::createChildFromStructure (RData *child_data, const QS
 		return 0;
 	}
 	RK_ASSERT (child_object);
-	RKGlobals::tracker ()->lockUpdates (true);	// object not yet added. prevent updates
+	RKModificationTracker::instance()->lockUpdates (true);	// object not yet added. prevent updates
 	child_object = updateChildStructure (child_object, child_data, true);
-	RKGlobals::tracker ()->lockUpdates (false);
+	RKModificationTracker::instance()->lockUpdates (false);
 
 	if (!child_object) {
 		RK_ASSERT (false);
 		return 0;
 	}
-	RKGlobals::tracker ()->beginAddObject (child_object, this, position);
+	RKModificationTracker::instance()->beginAddObject (child_object, this, position);
 	childmap.insert (position, child_object);
-	RKGlobals::tracker ()->endAddObject (child_object, this, position);
+	RKModificationTracker::instance()->endAddObject (child_object, this, position);
 	return child_object;
 }
 
@@ -172,7 +172,7 @@ void RContainerObject::updateChildren (RData *new_children) {
 				new_childmap.insert (i, old_child);
 			} else {
 				RK_DEBUG (OBJECTS, DL_DEBUG, "child no longer present: %s.", old_child->getFullName ().toLatin1 ().data ());
-				if (RKGlobals::tracker ()->removeObject (old_child, 0, true)) --i;
+				if (RKModificationTracker::instance()->removeObject (old_child, 0, true)) --i;
 				else (new_childmap.insert (i, old_child));
 			}
 		} else {
@@ -196,7 +196,7 @@ void RContainerObject::moveChild (RObject* child, int from_index, int to_index)
 	RK_ASSERT (childmap[from_index] == child);
 	RK_ASSERT (from_index < childmap.size ());
 	RK_ASSERT (to_index < childmap.size ());
-	RKGlobals::tracker ()->moveObject (this, child, from_index, to_index);
+	RKModificationTracker::instance()->moveObject (this, child, from_index, to_index);
 }
 
 int RContainerObject::numChildren () const {
@@ -301,9 +301,9 @@ RObject *RContainerObject::createPendingChild (const QString &name, int position
 
 	if ((position < 0) || (position > childmap.size ())) position = childmap.size ();
 
-	RKGlobals::tracker ()->beginAddObject (ret, this, position);
+	RKModificationTracker::instance()->beginAddObject (ret, this, position);
 	childmap.insert (position, ret);
-	RKGlobals::tracker ()->endAddObject (ret, this, position);
+	RKModificationTracker::instance()->endAddObject (ret, this, position);
 
 	return ret;
 }
diff --git a/rkward/core/renvironmentobject.cpp b/rkward/core/renvironmentobject.cpp
index 8860097c..5b50e514 100644
--- a/rkward/core/renvironmentobject.cpp
+++ b/rkward/core/renvironmentobject.cpp
@@ -120,7 +120,7 @@ void REnvironmentObject::updateFromR (RCommandChain *chain, const QStringList &c
 	for (int i = childmap.size () - 1; i >= 0; --i) {
 		RObject *object = childmap[i];
 		if (!current_symbols.contains (object->getShortName ())) {
-			if (object->isPending () || (!(RKGlobals::tracker ()->removeObject (object, 0, true)))) debug_baseline++;
+			if (object->isPending () || (!(RKModificationTracker::instance()->removeObject (object, 0, true)))) debug_baseline++;
 		}
 	}
 
@@ -177,11 +177,11 @@ void REnvironmentObject::updateNamespace (RData* new_data) {
 	if (!namespace_envir) {
 		namespace_envir = new RKNamespaceObject (this);
 		added = true;
-		RKGlobals::tracker ()->lockUpdates (true);
+		RKModificationTracker::instance()->lockUpdates (true);
 	}
 	namespace_envir->updateStructure (new_data->structureVector ().at (0));
 	if (added) {
-		RKGlobals::tracker ()->lockUpdates (false);
+		RKModificationTracker::instance()->lockUpdates (false);
 		setSpecialChildObject (namespace_envir, NamespaceObject);
 	}
 }
diff --git a/rkward/core/rfunctionobject.cpp b/rkward/core/rfunctionobject.cpp
index d1360c12..53447eba 100644
--- a/rkward/core/rfunctionobject.cpp
+++ b/rkward/core/rfunctionobject.cpp
@@ -43,7 +43,7 @@ bool RFunctionObject::updateStructure (RData *new_data) {
 
 	if (!RObject::updateStructure (new_data)) return false;
 
-	if (updateArguments (new_data)) RKGlobals::tracker ()->objectMetaChanged (this);
+	if (updateArguments (new_data)) RKModificationTracker::instance()->objectMetaChanged (this);
 
 	return true;
 }
diff --git a/rkward/core/rkmodificationtracker.cpp b/rkward/core/rkmodificationtracker.cpp
index 319b0205..0ce03375 100644
--- a/rkward/core/rkmodificationtracker.cpp
+++ b/rkward/core/rkmodificationtracker.cpp
@@ -20,9 +20,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "../debug.h"
 
+RKModificationTracker* RKModificationTracker::_instance = nullptr;
+
 RKModificationTracker::RKModificationTracker (QObject *parent) : RKObjectListModel (parent) {
 	RK_TRACE (OBJECTS);
-
+	RK_ASSERT(_instance == nullptr);  // singleton for now
+	_instance = this;
 	updates_locked = 0;
 }
 
@@ -446,13 +449,13 @@ void RObjectListener::objectDataChanged (RObject*, const RObject::ChangeSet *) {
 void RObjectListener::listenForObject (RObject* object) {
 	RK_TRACE (OBJECTS);
 
-	RKGlobals::tracker ()->addObjectListener (object, this);
+	RKModificationTracker::instance()->addObjectListener (object, this);
 	++num_watched_objects;
 }
 
 void RObjectListener::stopListenForObject (RObject* object) {
 	RK_TRACE (OBJECTS);
 
-	RKGlobals::tracker ()->removeObjectListener (object, this);
+	RKModificationTracker::instance()->removeObjectListener (object, this);
 	--num_watched_objects;
 }
diff --git a/rkward/core/rkmodificationtracker.h b/rkward/core/rkmodificationtracker.h
index bcbc579c..b8bbac85 100644
--- a/rkward/core/rkmodificationtracker.h
+++ b/rkward/core/rkmodificationtracker.h
@@ -113,6 +113,7 @@ class RKModificationTracker : public RKObjectListModel {
 public:
 	explicit RKModificationTracker (QObject *parent);
 	~RKModificationTracker ();
+	static RKModificationTracker* instance() { return _instance; };
 	
 /** the given object should be removed (either it was removed in the R-workspace, or the user requests removal of the object in an editor or the RObjectList). First, if the object is being edited somewhere, the user will get a chance to object to the removal. If the user does not object, the RKModificationTracker will remove the object and notify all interested listeners that the object really was removed. When calling from the RObjectList, you will likely set removed_in_workspace to true, to signal that the object-data is already gone in the workspace. */
 	bool removeObject (RObject *object, RKEditor *editor=0, bool removed_in_workspace=false);
@@ -146,6 +147,7 @@ friend class RObjectList;
 	void endAddObject (RObject *object, RObject* parent, int position);
 /** essentially like the above function(s). All objects listening for child position changed on the parent will be notified */
 	void moveObject (RContainerObject *parent, RObject* child, int old_index, int new_index);
+	static RKModificationTracker* _instance;
 };
 
 #endif
diff --git a/rkward/core/rkpseudoobjects.cpp b/rkward/core/rkpseudoobjects.cpp
index 1d46cc69..71ec1aaf 100644
--- a/rkward/core/rkpseudoobjects.cpp
+++ b/rkward/core/rkpseudoobjects.cpp
@@ -103,7 +103,7 @@ void RKOrphanNamespacesObject::updateFromR (RCommandChain* chain, const QStringL
 	for (int i = childmap.size () - 1; i >= 0; --i) {
 		RObject *object = childmap[i];
 		if (!current_symbols.contains (object->getShortName ())) {
-			RKGlobals::tracker ()->removeObject (object, 0, true);
+			RKModificationTracker::instance()->removeObject (object, 0, true);
 		}
 	}
 
@@ -112,9 +112,9 @@ void RKOrphanNamespacesObject::updateFromR (RCommandChain* chain, const QStringL
 		if (!findOrphanNamespace (current_symbols[i])) {
 			RKNamespaceObject *nso = new RKNamespaceObject (this, current_symbols[i]);
 			nso->type |= Incomplete;
-			RKGlobals::tracker ()->beginAddObject (nso, this, i);
+			RKModificationTracker::instance()->beginAddObject (nso, this, i);
 			childmap.insert (i, nso);
-			RKGlobals::tracker ()->endAddObject (nso, this, i);
+			RKModificationTracker::instance()->endAddObject (nso, this, i);
 		}
 	}
 
diff --git a/rkward/core/rkrownames.cpp b/rkward/core/rkrownames.cpp
index d4fffba3..53f52612 100644
--- a/rkward/core/rkrownames.cpp
+++ b/rkward/core/rkrownames.cpp
@@ -80,7 +80,7 @@ void RKRowNames::writeData (int from_row, int to_row, RCommandChain *chain) {
 	ChangeSet *set = new ChangeSet;
 	set->from_index = from_row;
 	set->to_index = to_row;
-	RKGlobals::tracker ()->objectDataChanged (this, set);
+	RKModificationTracker::instance()->objectDataChanged (this, set);
 }
 
 void RKRowNames::setText (int row, const QString &text) {
diff --git a/rkward/core/rkvariable.cpp b/rkward/core/rkvariable.cpp
index d9776303..7a68d944 100644
--- a/rkward/core/rkvariable.cpp
+++ b/rkward/core/rkvariable.cpp
@@ -178,8 +178,8 @@ void RKVariable::rCommandDone (RCommand *command) {
 		data->formatting_options = parseFormattingOptionsString (getMetaProperty ("format"));
 
 		ChangeSet *set = new ChangeSet (0, getLength (), true);
-		RKGlobals::tracker ()->objectDataChanged (this, set);
-		RKGlobals::tracker ()->objectMetaChanged (this);
+		RKModificationTracker::instance()->objectDataChanged (this, set);
+		RKModificationTracker::instance()->objectMetaChanged (this);
 		type -= (type & NeedDataUpdate);
 		discardUnsyncedChanges ();
 		lockSyncing (false);
@@ -368,7 +368,7 @@ void RKVariable::writeInvalidFields (QList<int> rows, RCommandChain *chain) {
 
 	if (data->previously_valid != data->invalid_fields.isEmpty ()) {
 		data->previously_valid = data->invalid_fields.isEmpty ();
-		RKGlobals::tracker ()->objectMetaChanged (this);
+		RKModificationTracker::instance()->objectMetaChanged (this);
 	}
 }
 
@@ -399,7 +399,7 @@ void RKVariable::writeData (int from_row, int to_row, RCommandChain *chain) {
 	if (!changed_invalids.isEmpty ()) writeInvalidFields (changed_invalids, chain);
 
 	ChangeSet *set = new ChangeSet (from_row, to_row);
-	RKGlobals::tracker ()->objectDataChanged (this, set);
+	RKModificationTracker::instance()->objectDataChanged (this, set);
 }
 
 void RKVariable::cellsChanged (int from_row, int to_row) {
@@ -713,7 +713,7 @@ void RKVariable::updateValueLabels () {
 	RK_TRACE (OBJECTS);
 
 	writeValueLabels (0);
-	RKGlobals::tracker ()->objectMetaChanged (this);
+	RKModificationTracker::instance()->objectMetaChanged (this);
 
 	ValueLabels *labels = data->value_labels;
 
@@ -734,7 +734,7 @@ void RKVariable::updateValueLabels () {
 
 	// also update display of all values:
 	ChangeSet *set = new ChangeSet (0, getLength () - 1);
-	RKGlobals::tracker ()->objectDataChanged (this, set);
+	RKModificationTracker::instance()->objectDataChanged (this, set);
 
 	// TODO: find out whether the object is valid after the operation and update accordingly!
 }
@@ -814,7 +814,7 @@ void RKVariable::setFormattingOptions (const FormattingOptions new_options) {
 
 	// also update display of all values:
 	ChangeSet *set = new ChangeSet (0, getLength () -1);
-	RKGlobals::tracker ()->objectDataChanged (this, set);
+	RKModificationTracker::instance()->objectDataChanged (this, set);
 }
 
 QString RKVariable::getFormattingOptionsString () const {
diff --git a/rkward/core/robject.cpp b/rkward/core/robject.cpp
index c440afae..0a44a33d 100644
--- a/rkward/core/robject.cpp
+++ b/rkward/core/robject.cpp
@@ -160,7 +160,7 @@ void RObject::setMetaProperty (const QString &id, const QString &value, bool syn
 	}
 
 	if (sync) writeMetaData (0);
-	RKGlobals::tracker ()->objectMetaChanged (this);
+	RKModificationTracker::instance()->objectMetaChanged (this);
 }
 
 QString RObject::makeClassString (const QString &sep) const {
@@ -251,7 +251,7 @@ void RObject::rCommandDone (RCommand *command) {
 		if (command->failed ()) {
 			RK_DEBUG (OBJECTS, DL_INFO, "command failed while trying to update object '%s'. No longer present?", getShortName ().toLatin1 ().data ());
 			// this may happen, if the object has been removed in the workspace in between
-			RKGlobals::tracker ()->removeObject (this, 0, true);
+			RKModificationTracker::instance()->removeObject (this, 0, true);
 			return;
 		}
 		if (parent && parent->isContainer ()) static_cast<RContainerObject*> (parent)->updateChildStructure (this, command);		// this may result in a delete, so nothing after this!
@@ -288,7 +288,7 @@ bool RObject::updateStructure (RData *new_data) {
 	properties_change = updateDimensions (new_data_data.at (StoragePositionDims));
 	properties_change = updateSlots (new_data_data.at (StoragePositionSlots));
 
-	if (properties_change) RKGlobals::tracker ()->objectMetaChanged (this);
+	if (properties_change) RKModificationTracker::instance()->objectMetaChanged (this);
 	if (type & NeedDataUpdate) updateDataFromR (0);
 
 	if (type & Incomplete) {
@@ -472,11 +472,11 @@ bool RObject::updateSlots (RData *new_data) {
 		if (!spo) {
 			spo = new RSlotsPseudoObject (this);
 			added = true;
-			RKGlobals::tracker ()->lockUpdates (true);
+			RKModificationTracker::instance()->lockUpdates (true);
 		}
 		bool ret = spo->updateStructure (new_data->structureVector ().at (0));
 		if (added) {
-			RKGlobals::tracker ()->lockUpdates (false);
+			RKModificationTracker::instance()->lockUpdates (false);
 			setSpecialChildObject (spo, SlotsObject);
 		}
 		return ret;
@@ -542,7 +542,7 @@ RObject *RObject::findChildByObjectModelIndex (int index) const {
 }
 
 QList <RKEditor*> RObject::editors () const {
-	return (RKGlobals::tracker ()->objectEditors (this));
+	return (RKModificationTracker::instance()->objectEditors (this));
 }
 
 void RObject::rename (const QString &new_short_name) {
@@ -563,7 +563,7 @@ void RObject::setSpecialChildObject (RObject* special, PseudoObjectType special_
 	if (special == old_special) return;
 
 	if (old_special) {
-		RKGlobals::tracker ()->removeObject (old_special, 0, true);
+		RKModificationTracker::instance()->removeObject (old_special, 0, true);
 		RK_ASSERT (!hasPseudoObject (special_type));	// should have been removed in the above statement via RObject::remove()
 	}
 
@@ -578,9 +578,9 @@ void RObject::setSpecialChildObject (RObject* special, PseudoObjectType special_
 		int index = getObjectModelIndexOf (special);
 		// HACK: Newly added object must not be included in the index before beginAddObject (but must be included above for getObjectModelIncexOf() to work)
 		contained_objects -= special_type;
-		RKGlobals::tracker ()->beginAddObject (special, this, index);
+		RKModificationTracker::instance()->beginAddObject (special, this, index);
 		contained_objects |= special_type;
-		RKGlobals::tracker ()->endAddObject (special, this, index);
+		RKModificationTracker::instance()->endAddObject (special, this, index);
 	}
 }
 
diff --git a/rkward/core/robjectlist.cpp b/rkward/core/robjectlist.cpp
index d7ac47a7..bdad2c81 100644
--- a/rkward/core/robjectlist.cpp
+++ b/rkward/core/robjectlist.cpp
@@ -50,9 +50,9 @@ RObjectList::RObjectList () : RContainerObject (0, QString ()) {
 
    // TODO: Do we really need tracker notification at this stage?
 	RKOrphanNamespacesObject *obj = new RKOrphanNamespacesObject (this);
-	RKGlobals::tracker ()->beginAddObject (obj, this, 0);      // first child after GlobalEnv
+	RKModificationTracker::instance()->beginAddObject (obj, this, 0);      // first child after GlobalEnv
 	orphan_namespaces = obj;
-	RKGlobals::tracker ()->endAddObject (obj, this, 0);
+	RKModificationTracker::instance()->endAddObject (obj, this, 0);
 }
 
 RObjectList::~RObjectList () {
@@ -182,9 +182,9 @@ void RObjectList::updateEnvironments (const QStringList &_env_names, bool force_
 		}
 		if (!obj) {
 			obj = createTopLevelEnvironment (name);
-			RKGlobals::tracker ()->beginAddObject (obj, this, i);
+			RKModificationTracker::instance()->beginAddObject (obj, this, i);
 			childmap.insert (i, obj);
-			RKGlobals::tracker ()->endAddObject (obj, this, i);
+			RKModificationTracker::instance()->endAddObject (obj, this, i);
 		}
 		newchildmap.insert (i, obj);
 	}
@@ -196,7 +196,7 @@ void RObjectList::updateEnvironments (const QStringList &_env_names, bool force_
 		
 		if (new_pos < 0) {	// environment is gone
 			RK_DEBUG (OBJECTS, DL_INFO, "removing toplevel environment %s from list", obj->getShortName ().toLatin1 ().data ());
-			if (RKGlobals::tracker ()->removeObject (obj, 0, true)) --i;
+			if (RKModificationTracker::instance()->removeObject (obj, 0, true)) --i;
 			else (newchildmap.insert (i, obj));
 		} else if (new_pos != i) {
 			// this call is rather expensive, all in all, but fortunately called very rarely
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 942e188a..0c1600cd 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -621,7 +621,7 @@ bool RKVarEditMetaModel::setData (const QModelIndex& index, const QVariant& valu
 		if (var->getShortName () != value.toString ()) {
 			if (!var->canRename ()) return false;
 			if (var->parentObject ()->isContainer ()) {
-				RKGlobals::tracker ()->renameObject (var, static_cast<RContainerObject*> (var->parentObject ())->validizeName (value.toString ()));
+				RKModificationTracker::instance()->renameObject (var, static_cast<RContainerObject*> (var->parentObject ())->validizeName (value.toString ()));
 			} else return false;
 		}
 	} else if (row == LabelRow) {
@@ -870,7 +870,7 @@ bool RKVarEditDataFrameModel::removeColumns (int column, int count, const QModel
 
 	while ((column + count) > objects.size ()) --count;
 	for (int i = column + count - 1; i >= column; --i) {	// we start at the end so that the index remains valid
-		RKGlobals::tracker ()->removeObject (objects[i]);
+		RKModificationTracker::instance()->removeObject (objects[i]);
 		// the comment in insertColumns, above: The object will be removed from our list in objectRemoved().
 	}
 	return true;
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index ed728392..c5febf14 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -99,7 +99,7 @@ void RKObjectListView::setObjectCurrent (RObject *object, bool only_if_none_curr
 	if (!object) return;
 	if (only_if_none_current && currentIndex ().isValid ()) return;
 
-	QModelIndex index = settings->mapFromSource (RKGlobals::tracker ()->indexFor (object));
+	QModelIndex index = settings->mapFromSource (RKModificationTracker::instance()->indexFor (object));
 	if (index.isValid ()) {
 		scrollTo (index);
 		setCurrentIndex (index);
@@ -113,7 +113,7 @@ void RKObjectListView::setRootObject (RObject *root) {
 	RK_TRACE (APP);
 
 	root_object = root;
-	QModelIndex index = settings->mapFromSource (RKGlobals::tracker ()->indexFor (root));
+	QModelIndex index = settings->mapFromSource (RKModificationTracker::instance()->indexFor (root));
 	if (index != rootIndex ()) {
 		setRootIndex (index);
 		settingsChanged ();    // Updates column sizes. Note: Recurses into this function, but with index == rootIndex()
@@ -162,10 +162,10 @@ void RKObjectListView::initialize () {
 
 	setUniformRowHeights (true);
 
-	settings->setSourceModel (RKGlobals::tracker ());
+	settings->setSourceModel (RKModificationTracker::instance());
 	setModel (settings);
 
-	QModelIndex genv = settings->mapFromSource (RKGlobals::tracker ()->indexFor (RObjectList::getGlobalEnv ()));
+	QModelIndex genv = settings->mapFromSource (RKModificationTracker::instance()->indexFor (RObjectList::getGlobalEnv ()));
 	setExpanded (genv, true);
 	setMinimumHeight (rowHeight (genv) * 5);
 	settingsChanged ();
diff --git a/rkward/rkglobals.cpp b/rkward/rkglobals.cpp
index d6e5feff..4d5241cd 100644
--- a/rkward/rkglobals.cpp
+++ b/rkward/rkglobals.cpp
@@ -8,7 +8,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include <qstring.h>
 
-RKModificationTracker *RKGlobals::mtracker;
 QVariantMap RKGlobals::startup_options;
 
 #include <QApplication>
diff --git a/rkward/rkglobals.h b/rkward/rkglobals.h
index fa0e6a31..70ab24c8 100644
--- a/rkward/rkglobals.h
+++ b/rkward/rkglobals.h
@@ -26,18 +26,12 @@ TODO: move the static members to the respective classes instead. There's no poin
 */
 class RKGlobals{
 public:
-/// static pointer to the RKModificationTracker
-	static RKModificationTracker *tracker () { return mtracker; };
-
 /// returns KDialog::marginHint (), without the need to include kdialog.h in all the sources
 	static int marginHint ();
 /// returns KDialog::spacingHint (), without the need to include kdialog.h in all the sources
 	static int spacingHint ();
 
 	static QVariantMap startup_options;
-private:
-	friend class RKWardMainWindow;
-	static RKModificationTracker *mtracker;
 };
 
 #endif
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 7ac65e0b..551e7bd7 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -139,8 +139,8 @@ RKWardMainWindow::RKWardMainWindow () : KParts::MainWindow ((QWidget *)0, (Qt::W
 	connect (partManager (), &KParts::PartManager::activePartChanged, this, &RKWardMainWindow::partChanged);
 
 	readOptions();
-	RKGlobals::mtracker = new RKModificationTracker (this);
-	initToolViewsAndR ();
+	new RKModificationTracker(this);
+	initToolViewsAndR();
 
 	///////////////////////////////////////////////////////////////////
 	// build the interface
@@ -177,13 +177,12 @@ RKWardMainWindow::RKWardMainWindow () : KParts::MainWindow ((QWidget *)0, (Qt::W
 RKWardMainWindow::~RKWardMainWindow() {
 	RK_TRACE (APP);
 
-	// these would not be strictly necessary, as we're exiting the app, anyway.
+	// these would not be strictly necessary, as we're exiting the app, anyway. (TODO: some deleted as QObject children, anyway. Clean up.)
 	delete RObjectList::getObjectList ();
 	delete RObjectBrowser::mainBrowser ();
 	delete RKCommandLog::getLog ();
 	delete RKConsole::mainConsole ();
 	delete RKHelpSearchWindow::mainHelpSearch ();
-	delete RKGlobals::tracker ();
 	delete RInterface::instance();
 	delete RControlWindow::getControl ();
 	factory ()->removeClient (RKComponentMap::getMap ());
diff --git a/rkward/windows/robjectbrowser.cpp b/rkward/windows/robjectbrowser.cpp
index 7b640126..16f543ef 100644
--- a/rkward/windows/robjectbrowser.cpp
+++ b/rkward/windows/robjectbrowser.cpp
@@ -206,7 +206,7 @@ void RObjectBrowserInternal::popupView () {
 
 void RObjectBrowserInternal::popupDelete () {
 	RK_TRACE (APP);
-	RKGlobals::tracker ()->removeObject (list_view->menuObject ());
+	RKModificationTracker::instance()->removeObject (list_view->menuObject ());
 }
 
 void RObjectBrowserInternal::popupUnload () {
@@ -229,7 +229,7 @@ void RObjectBrowserInternal::popupRename () {
 	if (ok) {
 		QString valid = static_cast<RContainerObject*> (list_view->menuObject ()->parentObject ())->validizeName (name);
 		if (valid != name) KMessageBox::sorry (this, i18n ("The name you specified was already in use or not valid. Renamed to %1", valid), i18n ("Invalid Name"));
-		RKGlobals::tracker ()->renameObject (list_view->menuObject (), valid);
+		RKModificationTracker::instance()->renameObject (list_view->menuObject (), valid);
 	}
 }
 
diff --git a/tests/analysis_plugins/linear_regression.rkcommands.R b/tests/analysis_plugins/linear_regression.rkcommands.R
index 3c6f9389..871ad7ab 100644
--- a/tests/analysis_plugins/linear_regression.rkcommands.R
+++ b/tests/analysis_plugins/linear_regression.rkcommands.R
@@ -1,6 +1,6 @@
 local({
 ## Compute
-results <- summary.lm (lm (warpbreaks[["breaks"]] ~ warpbreaks[["tension"]] + warpbreaks[["wool"]]))
+results <- summary (lm (warpbreaks[["breaks"]] ~ warpbreaks[["tension"]] + warpbreaks[["wool"]]))
 ## Print result
 rk.header ("Linear Regression")
 rk.print(results)



More information about the rkward-tracker mailing list