[rkward-cvs] SF.net SVN: rkward: [1492] trunk/rkward/rkward/rbackend
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Feb 26 23:08:50 UTC 2007
Revision: 1492
http://svn.sourceforge.net/rkward/?rev=1492&view=rev
Author: tfry
Date: 2007-02-26 15:08:50 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
Don't crash when hosting Rcmdr
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
trunk/rkward/rkward/rbackend/rthread.cpp
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2007-02-26 22:04:05 UTC (rev 1491)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R 2007-02-26 23:08:50 UTC (rev 1492)
@@ -363,8 +363,7 @@
if (!is.null (a)) {
.rk.preview.devices[[x]] <<- NULL
if (a %in% dev.list ()) {
- dev.set (a)
- dev.off ()
+ dev.off (a)
}
}
}
Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp 2007-02-26 22:04:05 UTC (rev 1491)
+++ trunk/rkward/rkward/rbackend/rthread.cpp 2007-02-26 23:08:50 UTC (rev 1492)
@@ -273,22 +273,29 @@
if (!current_output) return; // avoid creating loads of traces
RK_TRACE (RBACKEND);
- current_command->output_list.append (current_output);
- if (current_output->type == ROutput::Output) {
- current_command->status |= RCommand::HasOutput;
- } else if (current_output->type == ROutput::Error) {
- current_command->status |= RCommand::HasError;
+ if (current_command) {
+ current_command->output_list.append (current_output);
+ if (current_output->type == ROutput::Output) {
+ current_command->status |= RCommand::HasOutput;
+ } else if (current_output->type == ROutput::Error) {
+ current_command->status |= RCommand::HasError;
+ }
+
+ // pass a signal to the main thread for real-time update of output
+ QCustomEvent *event = new QCustomEvent (RCOMMAND_OUTPUT_EVENT);
+ ROutputContainer *outc = new ROutputContainer;
+ outc->output = current_output;
+ outc->command = current_command;
+ event->setData (outc);
+ qApp->postEvent (RKGlobals::rInterface (), event);
+
+ RK_DO (qDebug ("output '%s'", current_output->output.latin1 ()), RBACKEND, DL_DEBUG);
+ } else {
+ // running Rcmdr, eh?
+ RK_DO (qDebug ("output without receiver'%s'", current_output->output.latin1 ()), RBACKEND, DL_WARNING);
+ delete current_output;
}
-// pass a signal to the main thread for real-time update of output
- QCustomEvent *event = new QCustomEvent (RCOMMAND_OUTPUT_EVENT);
- ROutputContainer *outc = new ROutputContainer;
- outc->output = current_output;
- outc->command = current_command;
- event->setData (outc);
- qApp->postEvent (RKGlobals::rInterface (), event);
-
- RK_DO (qDebug ("output '%s'", current_output->output.latin1 ()), RBACKEND, DL_DEBUG);
// forget output
current_output = 0;
out_buf_len = 0;
@@ -314,8 +321,10 @@
MUTEX_LOCK;
// Unfortunately, errors still get printed to the output. We try this crude method for the time being:
flushOutput ();
- current_command->output_list.last ()->type = ROutput::Error;
- current_command->status |= RCommand::HasError;
+ if (current_command) {
+ current_command->output_list.last ()->type = ROutput::Error;
+ current_command->status |= RCommand::HasError;
+ }
RK_DO (qDebug ("error '%s'", call[0].latin1 ()), RBACKEND, DL_DEBUG);
MUTEX_UNLOCK;
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