[Scummvm-cvs-logs] SF.net SVN: scummvm:[42550] tools/branches/gsoc2009-gui/gui/pages.cpp
remere at users.sourceforge.net
remere at users.sourceforge.net
Fri Jul 17 02:54:50 CEST 2009
Revision: 42550
http://scummvm.svn.sourceforge.net/scummvm/?rev=42550&view=rev
Author: remere
Date: 2009-07-17 00:54:50 +0000 (Fri, 17 Jul 2009)
Log Message:
-----------
*Fixed very tricky bug with subprocesses not spawning correctly under Unix. Now it appears to work fine.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/gui/pages.cpp
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-17 00:27:21 UTC (rev 42549)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-17 00:54:50 UTC (rev 42550)
@@ -968,9 +968,16 @@
bool ProcessPage::onIdle(wxPanel *panel) {
const ToolGUI *tool = _topframe->_configuration.selectedTool;
-
+
if (!_thread)
return false;
+
+ // This function can be called recursively, by checking if lock is available, we avoid it
+ if(_output.mutex.TryLock() == wxMUTEX_BUSY)
+ return false;
+ else
+ // Immedietly unlock
+ _output.mutex.Unlock();
// Check if our subthread has something for us to do
{
@@ -989,8 +996,15 @@
if (_output.cmd) {
// We have a waiting subprocess to run, the other thread is sleeping since we could lock the mutex
+#ifdef __WINDOWS__
+ // Only windows needs this
+ // It hides the process window, on unix it doesn't appear to work very well
wxProcess proc(wxPROCESS_REDIRECT);
- _output.retval = wxExecute(wxString(_output.cmd, wxConvUTF8), wxEXEC_SYNC, &proc);
+ _output.retval = wxExecute(wxString(_output.cmd, ), wxEXEC_SYNC, &proc);
+#else
+ // Process windows are hidden by default under other OSes, so we don't need any special code
+ _output.retval = system(_output.cmd);
+#endif
_output.cmd = NULL;
// Signal the other thread that we have run the subprocess
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list