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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Jan 17 00:14:47 UTC 2008


Revision: 2324
          http://rkward.svn.sourceforge.net/rkward/?rev=2324&view=rev
Author:   tfry
Date:     2008-01-16 16:14:47 -0800 (Wed, 16 Jan 2008)

Log Message:
-----------
Fix race condition in deleting startup options

Modified Paths:
--------------
    trunk/rkward/rkward/main.cpp
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/windows/rkfilebrowser.cpp

Modified: trunk/rkward/rkward/main.cpp
===================================================================
--- trunk/rkward/rkward/main.cpp	2008-01-16 20:44:52 UTC (rev 2323)
+++ trunk/rkward/rkward/main.cpp	2008-01-17 00:14:47 UTC (rev 2324)
@@ -2,7 +2,7 @@
                           main.cpp  -  description
                              -------------------
     begin                : Tue Oct 29 20:06:08 CET 2002
-    copyright            : (C) 2002, 2005, 2006, 2007 by Thomas Friedrichsmeier 
+    copyright            : (C) 2002, 2005, 2006, 2007, 2008 by Thomas Friedrichsmeier 
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -76,7 +76,7 @@
 	options.add ("debugger <command>", ki18n ("Debugger (enclose any debugger arguments in single quotes ('') together with the command)"), "");
 	options.add ("disable-stack-check", ki18n ("Disable R C stack checking"), 0);
 
-	KAboutData aboutData("rkward", QByteArray (), ki18n ("RKWard"), VERSION, ki18n ("Frontend to the R statistics language"), KAboutData::License_GPL, ki18n ("(c) 2002, 2004, 2005, 2006, 2007"), KLocalizedString (), "http://rkward.sf.net", "rkward-devel at lists.sourceforge.net");
+	KAboutData aboutData("rkward", QByteArray (), ki18n ("RKWard"), VERSION, ki18n ("Frontend to the R statistics language"), KAboutData::License_GPL, ki18n ("(c) 2002, 2004, 2005, 2006, 2007, 2008"), KLocalizedString (), "http://rkward.sf.net", "rkward-devel at lists.sourceforge.net");
 	aboutData.addAuthor (ki18n ("%1").subs ("Thomas Friedrichsmeier"), ki18n ("Project leader / main developer"));
 	aboutData.addAuthor (ki18n ("%1").subs ("Pierre Ecochard"), ki18n ("C++ coder since 0.2.9"));
 	aboutData.addAuthor (ki18n ("%1").subs ("Stefan Roediger"), ki18n ("Many plugins, suggestions, marketing, translations"));
@@ -109,11 +109,9 @@
 	}
 
 	RKWardStartupOptions *stoptions = new RKWardStartupOptions;
-	KUrl *open_url = 0;
 	if (args->count ()) {
-		open_url = new KUrl (args->makeURL (args->arg (0).toLatin1()));
+		stoptions->initial_url = KUrl (args->makeURL (args->arg (0).toLatin1()));
 	}
-	stoptions->initial_url = open_url;
 	stoptions->no_stack_check = args->isSet ("disable-stack-check");
 
 	RKWardApplication app;

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2008-01-16 20:44:52 UTC (rev 2323)
+++ trunk/rkward/rkward/rkward.cpp	2008-01-17 00:14:47 UTC (rev 2324)
@@ -2,7 +2,7 @@
                           rkward.cpp  -  description
                              -------------------
     begin                : Tue Oct 29 20:06:08 CET 2002
-    copyright            : (C) 2002, 2005, 2006, 2007 by Thomas Friedrichsmeier 
+    copyright            : (C) 2002, 2005, 2006, 2007, 2008 by Thomas Friedrichsmeier 
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -147,7 +147,7 @@
 	} else {
 		startup_options = new RKWardStartupOptions;
 		startup_options->no_stack_check = false;
-		startup_options->initial_url = 0;
+		startup_options->initial_url = KUrl();
 	}
 
 	QTimer::singleShot (50, this, SLOT (doPostInit ()));
@@ -206,6 +206,8 @@
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (log, KMultiTabBar::Bottom);
 	RKCommandLog::rkcommand_log = log;
 
+	// startup options will be deleted from the R thread (TODO correct this!), so we need to copy the initial_url here, or run into race conditions
+	KUrl open_url = startup_options->initial_url;
 	startR ();
 
 	QString dummy = i18n ("RKWard has made great progress in the past few months and it is already helpful for many tasks, but some features may be lacking. You can help us by filing bug reports, feature requests, or providing feedback in any other form. Please visit http://rkward.sourceforge.net for more information.");
@@ -237,10 +239,8 @@
 
 	RKOutputWindow::initialize ();
 
-	if (startup_options->initial_url) {
-		openWorkspace (*(startup_options->initial_url));
-		delete (startup_options->initial_url);
-		startup_options->initial_url = 0;
+	if (!open_url.isEmpty()) {
+		openWorkspace (open_url);
 	} else {
 		StartupDialog::StartupDialogResult *result = StartupDialog::getStartupAction (this, fileOpenRecentWorkspace);
 		if (result->result == StartupDialog::EmptyWorkspace) {

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2008-01-16 20:44:52 UTC (rev 2323)
+++ trunk/rkward/rkward/rkward.h	2008-01-17 00:14:47 UTC (rev 2324)
@@ -2,7 +2,7 @@
 			rkward.h  -  description
 			-------------------
 begin                : Tue Oct 29 20:06:08 CET 2002 
-copyright            : (C) 2002, 2005, 2006, 2007 by Thomas Friedrichsmeier 
+copyright            : (C) 2002, 2005, 2006, 2007, 2008 by Thomas Friedrichsmeier 
 email                : tfry at users.sourceforge.net
 ***************************************************************************/
 
@@ -67,7 +67,7 @@
 class KSqueezedTextLabel;
 
 struct RKWardStartupOptions {
-	KUrl *initial_url;	/**< The workspace file to load on startup. If 0, show a dialog asking what to do. **/
+	KUrl initial_url;	/**< The workspace file to load on startup. If empty, show a dialog asking what to do. **/
 	bool no_stack_check;	/**< Disable R C stack checking */
 };
 

Modified: trunk/rkward/rkward/windows/rkfilebrowser.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.cpp	2008-01-16 20:44:52 UTC (rev 2323)
+++ trunk/rkward/rkward/windows/rkfilebrowser.cpp	2008-01-17 00:14:47 UTC (rev 2324)
@@ -2,7 +2,7 @@
                           rkfilebrowser  -  description
                              -------------------
     begin                : Thu Apr 26 2007
-    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2008 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 


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