Changeset 71402 in vbox for trunk/src/VBox
- Timestamp:
- Mar 20, 2018 1:43:07 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.cpp
r69500 r71402 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 # include <precomp.h> 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* GUI includes: */ 22 23 # include "QIProcess.h" 24 23 25 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 24 26 … … 26 28 #ifdef VBOX_WS_X11 27 29 # include <sys/wait.h> 28 #endif /* VBOX_WS_X11 */30 #endif 29 31 30 32 33 QIProcess::QIProcess(QObject *pParent /* = 0 */) 34 : QProcess(pParent) 35 { 36 } 37 31 38 /* static */ 32 QByteArray QIProcess::singleShot(const QString &strProcessName, int iTimeout )39 QByteArray QIProcess::singleShot(const QString &strProcessName, int iTimeout /* = 5000 */) 33 40 { 34 /* Why is it really needed is because of Qt4.3 bug with QProcess. 35 * This bug is about QProcess sometimes (~70%) do not receive 36 * notification about process was finished, so this makes 37 * 'bool QProcess::waitForFinished (int)' block the GUI thread and 38 * never dismissed with 'true' result even if process was really 39 * started&finished. So we just waiting for some information 40 * on process output and destroy the process with force. Due to 41 * QProcess::~QProcess() has the same 'waitForFinished (int)' blocker 42 * we have to change process state to QProcess::NotRunning. */ 41 // WORKAROUND: 42 // Why is it really needed is because of Qt4.3 bug with QProcess. 43 // This bug is about QProcess sometimes (~70%) do not receive 44 // notification about process was finished, so this makes 45 // 'bool QProcess::waitForFinished (int)' block the GUI thread and 46 // never dismissed with 'true' result even if process was really 47 // started&finished. So we just waiting for some information 48 // on process output and destroy the process with force. Due to 49 // QProcess::~QProcess() has the same 'waitForFinished (int)' blocker 50 // we have to change process state to QProcess::NotRunning. 43 51 52 /// @todo Do we still need this? 44 53 QByteArray result; 45 54 QIProcess process; … … 57 66 } 58 67 59 QIProcess::QIProcess(QObject *pParent /* = 0 */)60 : QProcess(pParent)61 {62 }63 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.h
r69500 r71402 5 5 6 6 /* 7 * Copyright (C) 2006-201 7Oracle Corporation7 * Copyright (C) 2006-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ QIProcess_h__19 #define __ QIProcess_h__18 #ifndef ___QIProcess_h___ 19 #define ___QIProcess_h___ 20 20 21 21 /* Qt includes: */ 22 22 #include <QProcess> 23 23 24 /* QProcess reimplementation for VBox GUI needs:*/24 /** QProcess extension for VBox GUI needs. */ 25 25 class QIProcess : public QProcess 26 26 { 27 27 Q_OBJECT; 28 28 29 /** Constructs our own file-dialog passing @a pParent to the base-class. 30 * Doesn't mean to be used directly, cause this subclass is a bunch of statics. */ 31 QIProcess(QObject *pParent = 0); 32 29 33 public: 30 34 31 /* Static single-shot method to execute some script: */ 35 /** Execute certain script specified by @a strProcessName 36 * and wait up to specified @a iTimeout amount of time for responce. */ 32 37 static QByteArray singleShot(const QString &strProcessName, 33 int iTimeout = 5000 /* wait for data maximum 5 seconds */); 34 35 protected: 36 37 /* Constructor: */ 38 QIProcess(QObject *pParent = 0); 38 int iTimeout = 5000); 39 39 }; 40 40 41 #endif /* __QIProcess_h__ */41 #endif /* !___QIProcess_h___ */ 42 42
Note:
See TracChangeset
for help on using the changeset viewer.