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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Sep 20 11:18:06 UTC 2010


Revision: 3055
          http://rkward.svn.sourceforge.net/rkward/?rev=3055&view=rev
Author:   tfry
Date:     2010-09-20 11:18:06 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
Don't crash on duplicate column names in the editor.
TODO: Editing these objects is still unsafe. There should be a check / warning.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/core/rcontainerobject.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2010-09-20 09:16:08 UTC (rev 3054)
+++ trunk/rkward/ChangeLog	2010-09-20 11:18:06 UTC (rev 3055)
@@ -1,8 +1,10 @@
-- Add option to specify default onscreen graphics dimensions		TODO: test on windows
+- Added full-featured plot history for the onscreen graphics device
+- Fixed: Potential crash when editing data-frame with duplicate column names		TODO: warn when editing such a data.frame
+- Added option to specify default onscreen graphics dimensions		TODO: test on windows
 - Fixed: Graphics windows used to assume a minimum size of 640*480 pixels, even if a smaller size was specified			/ TODO: check on Windows!
-- Add option to disable function argument hinting
+- Added option to disable function argument hinting
 - New functions rk.show.message() and rk.show.question() for user interaction from R code
-- New options for scripting GUI logic in plugins		TODO: document, merge common functionality of common.js and rkcomponentscriptiong.js, error handling
+- New options for scripting GUI logic in plugins		TODO: document, error handling
 - The current object of an active data editor can be referenced in plugins		TODO: document
 - Fixed: Placement of several menu items was broken - again - with KDE 4.4 and above
 - Allow sorting of results in help search window
@@ -14,10 +16,10 @@
 - Fixed: Would crash when trying to configure toolbars under certain circumstances (workaround for bug in kdelibs)
 - Fixed: Crash while analysing some objects returned by XML::xmlParseTree() for invalid XML
 - Fixed: Error while installing packages with R 2.11.0, when archiving packages in a non-existing directory
-- Add option to autosave script files (enabled by default)
+- Added option to autosave script files (enabled by default)
 - The tabbar in the main window now shows a context menu with options to close/detach a window
 - The tabs in the main window can now be re-ordered by dragging with the mouse (left click if compiled with Qt 4.5 or above, middle click for earlier versions)
-- Add alternating row backgrounds in data.frame-editor
+- Added alternating row backgrounds in data.frame-editor
 
 --- Version 0.5.3 - Apr-30-2010
 - Fixed: Windows->Activate->Window left / right actions were always disabled

Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp	2010-09-20 09:16:08 UTC (rev 3054)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp	2010-09-20 11:18:06 UTC (rev 3055)
@@ -141,7 +141,8 @@
 	unsigned int new_child_count = new_children->getDataLength ();
 
 	// first find out, which children are now available, copy the old ones, create the new ones
-	RObjectMap new_childmap;
+	RObjectMap new_childmap, old_childmap;
+	old_childmap = childmap;
 	for (unsigned int i = 0; i < new_child_count; ++i) {
 		RData *child_data = new_children->getStructureVector ()[i];
 		RK_ASSERT (child_data->getDataType () == RData::StructureVector);
@@ -151,7 +152,15 @@
 		RK_ASSERT (child_name_data->getDataLength () >= 1);
 		QString child_name = child_name_data->getStringVector ()[0];
 
-		RObject *child_object = findChildByName (child_name);
+		RObject *child_object = 0;
+		for (int j = 0; j < old_childmap.size (); ++j) {
+			RObject *obj = old_childmap[j];
+			if (obj && (obj->getShortName () == child_name)) {
+				child_object = obj;
+				old_childmap[j] = 0;	// in case of duplicate names, avoid finding the same child over and over again
+				break;
+			}
+		}
 		if (child_object) {
 			child_object = updateChildStructure (child_object, child_data);
 		} else {


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