SynchronousProcess: Show "process not responding" dialog once

Change-Id: I81834452d21f3f996103fb93b3b645f4f87d6251
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Orgad Shaneh
2013-01-12 23:42:16 +02:00
committed by Orgad Shaneh
parent 724c7568cf
commit 2ab6416a34

View File

@@ -208,6 +208,7 @@ struct SynchronousProcessPrivate {
int m_maxHangTimerCount;
bool m_startFailure;
bool m_timeOutMessageBoxEnabled;
bool m_waitingForUser;
QString m_binary;
ChannelBuffer m_stdOut;
@@ -219,7 +220,8 @@ SynchronousProcessPrivate::SynchronousProcessPrivate() :
m_hangTimerCount(0),
m_maxHangTimerCount(defaultMaxHangTimerCount),
m_startFailure(false),
m_timeOutMessageBoxEnabled(false)
m_timeOutMessageBoxEnabled(false),
m_waitingForUser(false)
{
}
@@ -412,10 +414,12 @@ static inline bool askToKill(const QString &binary = QString())
void SynchronousProcess::slotTimeout()
{
if (++d->m_hangTimerCount > d->m_maxHangTimerCount) {
if (!d->m_waitingForUser && (++d->m_hangTimerCount > d->m_maxHangTimerCount)) {
if (debug)
qDebug() << Q_FUNC_INFO << "HANG detected, killing";
d->m_waitingForUser = true;
const bool terminate = !d->m_timeOutMessageBoxEnabled || askToKill(d->m_binary);
d->m_waitingForUser = false;
if (terminate) {
SynchronousProcess::stopProcess(d->m_process);
d->m_result.result = SynchronousProcessResponse::Hang;