Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[transfer-engine] Delay transfer engine exit
When transferring multiple files via Bluetooth, we quickly receive
one transfer request after another, so this causes a timing issue
where the engine may quit immediately after the first request and
is in the process of closing down when the next request is received,
and thus cannot be started again for the next request.
  • Loading branch information
Bea Lam committed Feb 21, 2014
1 parent 00c749c commit 9f9c5b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/transferengine.cpp
Expand Up @@ -178,6 +178,16 @@ void TransferEnginePrivate::exitSafely()
{
if (!m_activityMonitor->activeTransfers()) {
qDebug() << Q_FUNC_INFO;
QTimer::singleShot(2000, this, SLOT(delayedExitSafely()));
}
}

void TransferEnginePrivate::delayedExitSafely()
{
if (m_activityMonitor->activeTransfers()) {
qDebug() << "Keeping transfer engine alive, transfers still ongoing";
} else {
qDebug() << "Stopping transfer engine";
qApp->exit();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/transferengine_p.h
Expand Up @@ -118,6 +118,7 @@ class TransferEnginePrivate: QObject

public Q_SLOTS:
void exitSafely();
void delayedExitSafely();
void enabledPluginsCheck();
void cleanupExpiredTransfers(const QList<int> &expiredIds);
void pluginDirChanged();
Expand Down

0 comments on commit 9f9c5b4

Please sign in to comment.