[rkward-cvs] SF.net SVN: rkward:[3399] trunk/rkward/rkward/rbackend/rkrbackend.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Jan 27 18:03:26 UTC 2011


Revision: 3399
          http://rkward.svn.sourceforge.net/rkward/?rev=3399&view=rev
Author:   tfry
Date:     2011-01-27 18:03:26 +0000 (Thu, 27 Jan 2011)

Log Message:
-----------
Another fix to the (emergency) exit strategy

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rkrbackend.cpp

Modified: trunk/rkward/rkward/rbackend/rkrbackend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.cpp	2011-01-27 14:27:53 UTC (rev 3398)
+++ trunk/rkward/rkward/rbackend/rkrbackend.cpp	2011-01-27 18:03:26 UTC (rev 3399)
@@ -368,6 +368,7 @@
 
 	if (RKRBackend::this_pointer->killed == RKRBackend::AlreadyDead) return;	// Nothing to clean up
 	if (!RKRBackend::this_pointer->r_running) return;			// prevent recursion (if an error occurs, here, we get jumped to the console repl, again!)
+	R_CheckUserInterrupt ();	// if there are any user interrupts pendinging, we want them handled *NOW*
 	RKRBackend::this_pointer->r_running = false;
 
 	// we could be in a signal handler, and the stack base may have changed.
@@ -377,18 +378,22 @@
 	if ((status != 0) && (RKRBackend::this_pointer->killed != RKRBackend::ExitNow)) RKRBackend::this_pointer->killed = RKRBackend::EmergencySaveThenExit;
 
 	if (RKRBackend::this_pointer->killed == RKRBackend::EmergencySaveThenExit) {
-		QString filename;
-		QDir dir (RKRBackendProtocolBackend::dataDir ());
-		int i=0;
-		while (true) {
-			filename = "rkward_recover" + QString::number (i) + ".RData";
-			if (!dir.exists (filename)) break;
-			i++;
+		if (R_DirtyImage) {
+			QString filename;
+			QDir dir (RKRBackendProtocolBackend::dataDir ());
+			int i=0;
+			while (true) {
+				filename = "rkward_recover" + QString::number (i) + ".RData";
+				if (!dir.exists (filename)) break;
+				i++;
+			}
+			filename = dir.absoluteFilePath (filename);
+
+			R_SaveGlobalEnvToFile (filename.toLocal8Bit ().data ());
+			qDebug ("Created emergency save file in %s", qPrintable (filename));
+		} else {
+			qDebug ("Image not dirty while crashing. No emergency save created.");
 		}
-		filename = dir.absoluteFilePath (filename);
-
-		if (R_DirtyImage) R_SaveGlobalEnvToFile (filename.toLocal8Bit ().data ());
-		qDebug ("Created emergency save file in %s", qPrintable (filename));
 	}
 
 	if (saveact != SA_SUICIDE) {


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