1 | Index: qprocess_pm.cpp |
---|
2 | =================================================================== |
---|
3 | --- qprocess_pm.cpp (revision 185) |
---|
4 | +++ qprocess_pm.cpp (working copy) |
---|
5 | @@ -63,7 +63,7 @@ |
---|
6 | #include <sys/wait.h> |
---|
7 | #endif |
---|
8 | |
---|
9 | -//#define QT_QPROCESS_DEBUG |
---|
10 | +// #define QT_QPROCESS_DEBUG |
---|
11 | |
---|
12 | #define HF_STDIN HFILE( 0 ) |
---|
13 | #define HF_STDOUT HFILE( 1 ) |
---|
14 | @@ -283,6 +283,7 @@ |
---|
15 | QIntDict<QProcess> pipeKeys; |
---|
16 | PipeStates pipeStates; |
---|
17 | QMutex lock; |
---|
18 | + USHORT latestKey; |
---|
19 | }; |
---|
20 | |
---|
21 | QProcessMonitor::QProcessMonitor() |
---|
22 | @@ -298,6 +299,7 @@ |
---|
23 | |
---|
24 | thread = new Thread( this ); |
---|
25 | Q_ASSERT( thread != NULL ); |
---|
26 | + latestKey = 0; |
---|
27 | } |
---|
28 | |
---|
29 | QProcessMonitor::~QProcessMonitor() |
---|
30 | @@ -332,7 +334,10 @@ |
---|
31 | |
---|
32 | Q_ASSERT( pipe->pipe != HP_NULL && pipe->key == KEY_NULL ); |
---|
33 | |
---|
34 | - pipe->key = USHORT( pipe->pipe ); |
---|
35 | + latestKey++; |
---|
36 | + if (latestKey == KEY_NULL) latestKey++; // avoid overflow to Null value |
---|
37 | + pipe->key = latestKey; |
---|
38 | + // pipe->key = USHORT( pipe->pipe ); |
---|
39 | APIRET rc = DosSetNPipeSem( pipe->pipe, (HSEM) pipeSem, pipe->key ); |
---|
40 | if ( rc != NO_ERROR ) { |
---|
41 | #if defined(QT_CHECK_STATE) || defined(QT_QPROCESS_DEBUG) |
---|
42 | @@ -348,7 +353,6 @@ |
---|
43 | void QProcessMonitor::removePipe( QProcessPrivate::Pipe *pipe ) |
---|
44 | { |
---|
45 | Q_ASSERT( pipe->pipe != HP_NULL && pipe->key != KEY_NULL ); |
---|
46 | - |
---|
47 | /// @todo (r=dmik) is this really necessary to detach pipeSem? |
---|
48 | DosSetNPipeSem( pipe->pipe, 0, 0 ); |
---|
49 | bool ok = pipeKeys.remove( pipe->key ); |
---|