Changeset 159 for trunk


Ignore:
Timestamp:
Dec 3, 2006, 11:23:18 PM (19 years ago)
Author:
dmik
Message:

Kernel/QProcess:

  • Fixed access violation (accessing a deleted instance) when QT_QPROCESS_DEBUG was defined.
  • Fixed: if a program to execute was a shell script (started via '%COMSPEC% /c'), it was not separated by a space from its first argument (if any).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qprocess_pm.cpp

    r134 r159  
    544544            QProcess *proc = (QProcess *) PVOIDFROMMP( mp1 );
    545545            USHORT key = SHORT1FROMMP( mp2 );
     546            // check parameter validity (we can safely do it outside the lock
     547            // because the GUI thread is the only that can modify pipeKeys)
     548            if ( proc == pipeKeys.find( key ) ) {
    546549#if defined(QT_QPROCESS_DEBUG)
    547550            qDebug( "QProcessMonitor::WM_U_PIPE_RDATA: proc=%p (%s/%s) d=%p "
     
    549552                    proc, proc->name(), proc->className(), proc->d, key );
    550553#endif
    551             // check parameter validity (we can safely do it outside the lock
    552             // because the GUI thread is the only that can modify pipeKeys)
    553             if ( proc == pipeKeys.find( key ) ) {
    554554                QProcessPrivate *d = proc->d;
    555555                if ( d->stdout.key == key ) {
     
    560560                }
    561561            }
     562#if defined(QT_QPROCESS_DEBUG)
     563            else {
     564                qDebug( "QProcessMonitor::WM_U_PIPE_RDATA: proc=%p (invalid)",
     565                        proc );
     566            }
     567#endif                         
    562568            break;
    563569        }
     
    565571            QProcess *proc = (QProcess *) PVOIDFROMMP( mp1 );
    566572            USHORT key = SHORT1FROMMP( mp2 );
     573            // check parameter validity (we can safely do it outside the lock
     574            // because the GUI thread is the only that can modify pipeKeys)
     575            if ( proc == pipeKeys.find( key ) ) {
    567576#if defined(QT_QPROCESS_DEBUG)
    568577            qDebug( "QProcessMonitor::WM_U_PIPE_CLOSE: proc=%p (%s/%s) d=%p "
     
    570579                    proc, proc->name(), proc->className(), proc->d, key );
    571580#endif
    572             // check parameter validity (we can safely do it outside the lock
    573             // because the GUI thread is the only that can modify pipeKeys)
    574             if ( proc == pipeKeys.find( key ) ) {
    575581                QProcessPrivate *d = proc->d;
    576582                QProcessPrivate::Pipe *pipe = d->findPipe( key );
     
    586592                }
    587593            }
     594#if defined(QT_QPROCESS_DEBUG)
     595            else {
     596                qDebug( "QProcessMonitor::WM_U_PIPE_CLOSE: proc=%p (invalid)",
     597                        proc );
     598            }
     599#endif                         
    588600            break;
    589601        }
     
    686698   
    687699#if defined(QT_QPROCESS_DEBUG)
    688     qDebug( "~QProcess::init(): d=%p", d );
     700    qDebug( "QProcess::init(): d=%p", d );
    689701#endif
    690702}
     
    954966             buf.resize( sz );
    955967        strcpy( buf.data(), appNameFull );
    956         sprintf( buf.data() + shellLen + 1, hasSpaces ? "/c \"%s\"" : "/c %s",
    957                  appName.data() );
    958         if ( appArgsLen )
    959             strcat( buf.data() + shellLen + 1, appArgs.data() );
     968        char *argsPtr = buf.data() + shellLen + 1;
     969        sprintf( argsPtr, hasSpaces ? "/c \"%s\"" : "/c %s", appName.data() );
     970        if ( appArgsLen ) {
     971                        strcat( argsPtr, " " );
     972            strcat( argsPtr, appArgs.data() );
     973        }
    960974        buf[ sz - 1 ] = '\0';
    961975    }
Note: See TracChangeset for help on using the changeset viewer.