forked from qt-creator/qt-creator
QmlProfiler: manage premature disconnection when app killed
The profiler tool was assuming that the socket would get disconnected after the application was stopped by the user. Sometimes it is not the case. This patch manages the oposite situation gracefully. Change-Id: I4ae439bf2ce6caece37e97f735e980d18c446df0 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -236,6 +236,11 @@ void QmlProfilerClientManager::connectToClient()
|
||||
}
|
||||
}
|
||||
|
||||
bool QmlProfilerClientManager::isConnected() const
|
||||
{
|
||||
return d->connection && d->connection->isConnected();
|
||||
}
|
||||
|
||||
void QmlProfilerClientManager::disconnectClient()
|
||||
{
|
||||
// this might be actually be called indirectly by QDDConnectionPrivate::readyRead(), therefore allow
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
void clearBufferedData();
|
||||
void discardPendingData();
|
||||
bool isConnected() const;
|
||||
|
||||
signals:
|
||||
void connectionFailed();
|
||||
|
||||
@@ -719,6 +719,12 @@ void QmlProfilerTool::handleHelpRequest(const QString &link)
|
||||
void QmlProfilerTool::profilerStateChanged()
|
||||
{
|
||||
switch (d->m_profilerState->currentState()) {
|
||||
case QmlProfilerStateManager::AppDying : {
|
||||
// If already disconnected when dying, check again that all data was read
|
||||
if (!d->m_profilerConnections->isConnected())
|
||||
QTimer::singleShot(0, this, SLOT(clientsDisconnected()));
|
||||
break;
|
||||
}
|
||||
case QmlProfilerStateManager::AppKilled : {
|
||||
showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user