[rkward-cvs] rkward/rkward/dataeditor rkeditordataframe.cpp,1.27,1.28
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Sun Oct 2 14:28:26 UTC 2005
Update of /cvsroot/rkward/rkward/rkward/dataeditor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv691/rkward/dataeditor
Modified Files:
rkeditordataframe.cpp
Log Message:
Add quick hack to prevent crash, when opening an object for editing that has changed its structure in the workspace
Index: rkeditordataframe.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dataeditor/rkeditordataframe.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** rkeditordataframe.cpp 29 Sep 2005 16:02:50 -0000 1.27
--- rkeditordataframe.cpp 2 Oct 2005 14:28:24 -0000 1.28
***************
*** 105,115 ****
void RKEditorDataFrame::rCommandDone (RCommand *command) {
RK_TRACE (EDITOR);
if (command->getFlags () == GET_NAMES_COMMAND) {
! while (command->stringVectorLength () < numTrueCols ()) {
deleteColumn (0);
}
!
// set the names and meta-information
for (int i = 0; i < command->stringVectorLength (); ++i) {
if (numTrueCols () <= i) {
insertNewColumn ();
--- 105,126 ----
void RKEditorDataFrame::rCommandDone (RCommand *command) {
RK_TRACE (EDITOR);
+
if (command->getFlags () == GET_NAMES_COMMAND) {
! while (command->stringVectorLength () < numTrueCols ()) { // get rid of superficial columns
deleteColumn (0);
}
!
! // this is really just a very preliminary HACK. If stringVectorLength () is 0, this can not be a data.frame any longer.
! // abort in order to avoid crash.
! // TODO: actually, we should have a true check for object type each time before opening an object.
! if (!command->stringVectorLength ()) {
! open_chain = RKGlobals::rInterface ()->closeChain (open_chain);
! RKGlobals::editorManager ()->closeEditor (this);
! return;
! }
!
// set the names and meta-information
for (int i = 0; i < command->stringVectorLength (); ++i) {
+ qDebug ("alive %d of %d", i+1, command->stringVectorLength ());
if (numTrueCols () <= i) {
insertNewColumn ();
***************
*** 117,120 ****
--- 128,136 ----
// TODO: make clean
RKVariable *current_child = static_cast<RKVariable *> (static_cast <RContainerObject*> (getObject ())->findChild (command->getStringVector ()[i]));
+ // this is really just a very preliminary HACK. If we find new children now exist, create them now in order to avoid crash..
+ // TODO: actually, we should have a true check for object type/structure each time before opening an object.
+ if (!current_child) {
+ current_child = static_cast<RKVariable *> (static_cast<RContainerObject *> (getObject ())->createNewChild (command->getStringVector ()[i], this));
+ }
if (current_child->isVariable ()) {
if (!getColObject (i)) { // if we initialized the table to empty, the object may already exist in our map
More information about the rkward-tracker
mailing list