[rkward-cvs] SF.net SVN: rkward: [1309] trunk/rkward/rkward/rbackend/rthread.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Feb 4 22:40:17 UTC 2007


Revision: 1309
          http://svn.sourceforge.net/rkward/?rev=1309&view=rev
Author:   tfry
Date:     2007-02-04 14:40:17 -0800 (Sun, 04 Feb 2007)

Log Message:
-----------
Fix a thread race condition

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

Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp	2007-02-04 22:14:39 UTC (rev 1308)
+++ trunk/rkward/rkward/rbackend/rthread.cpp	2007-02-04 22:40:17 UTC (rev 1309)
@@ -2,7 +2,7 @@
                           rthread  -  description
                              -------------------
     begin                : Mon Aug 2 2004
-    copyright            : (C) 2004, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -105,9 +105,11 @@
 			RCommand *command = RCommandStack::regular_stack->pop ();
 			
 			if (command) {
+				// store type. Inside doCommand, command may be deleted (if the other thread gets called)!
+				bool check_list = (command->type () & (RCommand::User | RCommand::ObjectListUpdate));
 				// mutex will be unlocked inside
 				doCommand (command);
-				checkObjectUpdatesNeeded (command->type () & (RCommand::User | RCommand::ObjectListUpdate));
+				checkObjectUpdatesNeeded (check_list);
 				processX11Events ();
 			}
 		


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