[rkward-cvs] SF.net SVN: rkward:[4344] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 2 11:24:28 UTC 2012


Revision: 4344
          http://rkward.svn.sourceforge.net/rkward/?rev=4344&view=rev
Author:   tfry
Date:     2012-10-02 11:24:28 +0000 (Tue, 02 Oct 2012)
Log Message:
-----------
Fix some problems around pending objects (which have been created in an editor, and have not yet been seen in R).
This fixes some (but not all) race conditions on newly created tables. Not sure, whether it does anything to
fix the problems with factors as reported on the mailing list.

Modified Paths:
--------------
    trunk/rkward/rkward/core/rcontainerobject.cpp
    trunk/rkward/rkward/core/renvironmentobject.cpp
    trunk/rkward/rkward/core/rkvariable.cpp
    trunk/rkward/rkward/core/robject.cpp
    trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp

Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp	2012-10-02 08:36:11 UTC (rev 4343)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp	2012-10-02 11:24:28 UTC (rev 4344)
@@ -2,7 +2,7 @@
                           rcontainerobject  -  description
                              -------------------
     begin                : Thu Aug 19 2004
-    copyright            : (C) 2004, 2006, 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007, 2009, 2010, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -255,7 +255,7 @@
 	rownames_object->extendToLength (childlen);	// in case it is being edited
 	rownames_object->dimensions[0] = childlen;
 
-	if (rownames_object->isType (NeedDataUpdate)) {
+	if (rownames_object->isType (NeedDataUpdate) && (!isPending ())) {
 		rownames_object->updateDataFromR (0);
 	}
 }

Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp	2012-10-02 08:36:11 UTC (rev 4343)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp	2012-10-02 11:24:28 UTC (rev 4344)
@@ -138,7 +138,10 @@
 	// which ones are new in the list?
 	for (int i = current_symbols.count () - 1; i >= 0; --i) {
 		RObject *child = findChildByName (current_symbols[i]);
-		if (!child) child = createPendingChild (current_symbols[i], i, false, false);
+		if (!child) {
+			child = createPendingChild (current_symbols[i], i, false, false);
+			child->type -= RObject::Pending;	// HACK: Child is not actually pending: We've seen it!
+		}
 		if (child->isPending ()) child->updateFromR (chain);
 	}
 

Modified: trunk/rkward/rkward/core/rkvariable.cpp
===================================================================
--- trunk/rkward/rkward/core/rkvariable.cpp	2012-10-02 08:36:11 UTC (rev 4343)
+++ trunk/rkward/rkward/core/rkvariable.cpp	2012-10-02 11:24:28 UTC (rev 4344)
@@ -75,7 +75,9 @@
 
 		// destroy and re-allocate edit data
 		data->num_listeners = 0;	// to avoid the otherwise useful assert in discardEditData
+		bool pending = isPending ();
 		discardEditData ();
+		if (pending) type |= Pending;	// flag is cleared in discardEditData()
 		setDataType (new_type);
 		allocateEditData ();
 
@@ -236,7 +238,7 @@
 
 	if (!data) {
 		allocateEditData ();
-		if (!isPending ()) updateDataFromR (0);
+		if (!(isPending () || (parentObject () && parentObject ()->isPending ()))) updateDataFromR (0);
 	}
 	++(data->num_listeners);
 }

Modified: trunk/rkward/rkward/core/robject.cpp
===================================================================
--- trunk/rkward/rkward/core/robject.cpp	2012-10-02 08:36:11 UTC (rev 4343)
+++ trunk/rkward/rkward/core/robject.cpp	2012-10-02 11:24:28 UTC (rev 4344)
@@ -279,6 +279,11 @@
 
 	if (!canAccommodateStructure (new_data)) return false;
 
+	if (isPending ()) {
+		type -= Pending;
+		return true;	// Do not update any info for pending objects
+	}
+
 	bool properties_change = false;
 
 	RData::RDataStorage new_data_data = new_data->structureVector ();
@@ -291,7 +296,6 @@
 
 	if (properties_change) RKGlobals::tracker ()->objectMetaChanged (this);
 	if (type & NeedDataUpdate) updateDataFromR (0);
-	if (isPending ()) type -= Pending;
 
 	if (type & Incomplete) {
 		// If the (new!) type is "Incomplete", it means, the structure getter simply stopped at this point.

Modified: trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp
===================================================================
--- trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp	2012-10-02 08:36:11 UTC (rev 4343)
+++ trunk/rkward/rkward/dataeditor/rkvareditmodel.cpp	2012-10-02 11:24:28 UTC (rev 4344)
@@ -2,7 +2,7 @@
                           rkvareditmodel  -  description
                              -------------------
     begin                : Mon Nov 05 2007
-    copyright            : (C) 2007, 2010, 2011 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2010, 2011, 2012 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -962,13 +962,15 @@
 	command.append (")");
 
 	// push all children
-	RKGlobals::rInterface ()->issueCommand (new RCommand (command, RCommand::Sync | RCommand::ObjectListUpdate), sync_chain);
+	RKGlobals::rInterface ()->issueCommand (new RCommand (command, RCommand::Sync), sync_chain);
 	for (int col=0; col < objects.size (); ++col) {
 		objects[col]->restore (sync_chain);
 	}
 
 	// now store the meta-data
 	dataframe->writeMetaData (sync_chain);
+
+	RKGlobals::rInterface ()->issueCommand (new RCommand (QString (), RCommand::Sync | RCommand::EmptyCommand | RCommand::ObjectListUpdate), sync_chain);
 }
 
 void RKVarEditDataFrameModel::restoreObject (RObject* object, RCommandChain* chain) {

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list