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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue May 17 16:48:31 UTC 2011


Revision: 3569
          http://rkward.svn.sourceforge.net/rkward/?rev=3569&view=rev
Author:   tfry
Date:     2011-05-17 16:48:31 +0000 (Tue, 17 May 2011)

Log Message:
-----------
Fix for crash / no plot coming up, when trying to plot from R Commander inside RKWard.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rbackend/rinterface.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-05-17 12:09:58 UTC (rev 3568)
+++ trunk/rkward/ChangeLog	2011-05-17 16:48:31 UTC (rev 3569)
@@ -1,4 +1,5 @@
 --- Version 0.5.6 - May-XX-2011
+- Fixed: Potential crash when creating plots from a tcl/tk based GUI
 - Fix compilation on FreeBSD
 - Replace the R console's "Copy selection cleaned" action with "Copy commands, only", which will omit any non-command regions in the copy
 - Add "Copy lines to output" action to copy highlighted lines from the R console or script editors to the output window
@@ -13,7 +14,7 @@
 - Added convenience R function rk.list() to allow simplification of plugin code
 - Added stack-based window switching using Ctrl+(Shift)+Tab; this replaces the old "Next Window" and "Previous Window" actions
 - Fixed: Graphics device windows would disappear when trying to attach them to the main window with some versions of Qt
-- Fixed: tcl/tk widgets would locki up after running commands in the R Console
+- Fixed: tcl/tk widgets would lock up after running commands in the R Console
 - Provide a template for bug reports, containing standardized information on the RKWard setup in Help->Report Bug...
 - When loading a (local) workspace, change the working directory to the directory of the workspace (configurable)
 - Include the sidebar position of tool windows when saving / restoring the workplace layout

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2011-05-17 12:09:58 UTC (rev 3568)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2011-05-17 16:48:31 UTC (rev 3569)
@@ -318,7 +318,8 @@
 		}
 		tryNextCommand ();
 	} else if (request->type == RBackendRequest::HistoricalSubstackRequest) {
-		processHistoricalSubstackRequest (request);
+		command_requests.append (request);
+		processHistoricalSubstackRequest (request->params["call"].toStringList ());
 	} else if (request->type == RBackendRequest::PlainGenericRequest) {
 		request->params["return"] = QVariant (processPlainGenericRequest (request->params["call"].toStringList ()));
 		RKRBackendProtocolFrontend::setRequestCompleted (request);
@@ -586,16 +587,18 @@
 	return QStringList ();
 }
 
-void RInterface::processHistoricalSubstackRequest (RBackendRequest* request) {
+void RInterface::processHistoricalSubstackRequest (const QStringList &calllist) {
 	RK_TRACE (RBACKEND);
 
-	command_requests.append (request);
-	RK_ASSERT (!all_current_commands.isEmpty ());
-	RCommandStack *reply_stack = new RCommandStack (all_current_commands.last ());
-	RCommandChain *in_chain = reply_stack->startChain (reply_stack);
+	RCommand *current_command = runningCommand ();
+	RCommandChain *in_chain;
+	if (!current_command) {
+		// This can happen for Tcl events. Create a dummy command on the stack to keep things looping.
+		current_command = new RCommand (QString (), RCommand::App | RCommand::EmptyCommand | RCommand::Sync);
+		issueCommand (current_command);
+	}
+	in_chain = startChain (new RCommandStack (current_command));
 
-	QStringList calllist = request->params["call"].toStringList ();
-
 	QString call = calllist.value (0);
 	if (call == "sync") {
 		RK_ASSERT (calllist.count () >= 2);

Modified: trunk/rkward/rkward/rbackend/rinterface.h
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.h	2011-05-17 12:09:58 UTC (rev 3568)
+++ trunk/rkward/rkward/rbackend/rinterface.h	2011-05-17 16:48:31 UTC (rev 3569)
@@ -94,7 +94,7 @@
 		RecordingCommandsWithSync
 	} command_logfile_mode;
 
-	void processHistoricalSubstackRequest (RBackendRequest *request);
+	void processHistoricalSubstackRequest (const QStringList &calllist);
 	QStringList processPlainGenericRequest (const QStringList &calllist);
 	void processRBackendRequest (RBackendRequest *request);
 


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