Index: qprocess_pm.cpp =================================================================== --- qprocess_pm.cpp (revision 185) +++ qprocess_pm.cpp (working copy) @@ -63,7 +63,7 @@ #include #endif -//#define QT_QPROCESS_DEBUG +// #define QT_QPROCESS_DEBUG #define HF_STDIN HFILE( 0 ) #define HF_STDOUT HFILE( 1 ) @@ -283,6 +283,7 @@ QIntDict pipeKeys; PipeStates pipeStates; QMutex lock; + USHORT latestKey; }; QProcessMonitor::QProcessMonitor() @@ -298,6 +299,7 @@ thread = new Thread( this ); Q_ASSERT( thread != NULL ); + latestKey = 0; } QProcessMonitor::~QProcessMonitor() @@ -332,7 +334,10 @@ Q_ASSERT( pipe->pipe != HP_NULL && pipe->key == KEY_NULL ); - pipe->key = USHORT( pipe->pipe ); + latestKey++; + if (latestKey == KEY_NULL) latestKey++; // avoid overflow to Null value + pipe->key = latestKey; + // pipe->key = USHORT( pipe->pipe ); APIRET rc = DosSetNPipeSem( pipe->pipe, (HSEM) pipeSem, pipe->key ); if ( rc != NO_ERROR ) { #if defined(QT_CHECK_STATE) || defined(QT_QPROCESS_DEBUG) @@ -348,7 +353,6 @@ void QProcessMonitor::removePipe( QProcessPrivate::Pipe *pipe ) { Q_ASSERT( pipe->pipe != HP_NULL && pipe->key != KEY_NULL ); - /// @todo (r=dmik) is this really necessary to detach pipeSem? DosSetNPipeSem( pipe->pipe, 0, 0 ); bool ok = pipeKeys.remove( pipe->key );