forked from qt-creator/qt-creator
		
	Debugger [CDB]: Release COM interfaces on RunControl finished.
Ensure that at most one instance of the CDBEngine is alive. Prevent inconsistent debugger states if several sessions are started. Squashed cherry-picked commits from master correcting the plugin state handling (2efdeb5cd0,57f7616286). Reviewed-by: hjk Task-number: QTCREATORBUG-2894 (cherry picked from commit5a5ba58dc9)
This commit is contained in:
		| @@ -168,6 +168,10 @@ bool CdbEnginePrivate::init(QString *errorMessage) | ||||
| DebuggerEngine *CdbEngine::create(const DebuggerStartParameters &sp, | ||||
|                                        QString *errorMessage) | ||||
| { | ||||
|     if (!CdbCore::CoreEngine::interfacesAvailable()) { | ||||
|         *errorMessage = CdbEngine::tr("An instance of the CDB engine is still running; cannot create an a new instance."); | ||||
|         return 0; | ||||
|     } | ||||
|     CdbEngine *rc = new CdbEngine(sp); | ||||
|     if (rc->m_d->init(errorMessage)) { | ||||
|         rc->syncDebuggerPaths(); | ||||
| @@ -563,6 +567,7 @@ void CdbEngine::processTerminated(unsigned long exitCode) | ||||
|  | ||||
| bool CdbEnginePrivate::endInferior(bool detachOnly, QString *errorMessage) | ||||
| { | ||||
|     QTC_ASSERT(hasInterfaces(), return true; ) | ||||
|     // Prevent repeated invocation. | ||||
|     const bool hasHandles = m_hDebuggeeProcess != NULL; | ||||
|     if (debugCDBExecution) | ||||
| @@ -635,6 +640,8 @@ void CdbEnginePrivate::endDebugging(bool detachOnly) | ||||
|     if (debugCDBExecution) | ||||
|         qDebug("endDebugging() detach=%d, state=%s", detachOnly, DebuggerEngine::stateName(m_engine->state())); | ||||
|  | ||||
|     QTC_ASSERT(hasInterfaces(), return; ) | ||||
|  | ||||
|     switch (m_engine->state()) { | ||||
|     case DebuggerNotReady: | ||||
|     case EngineShutdownOk: | ||||
| @@ -659,6 +666,8 @@ void CdbEnginePrivate::endDebugging(bool detachOnly) | ||||
|         m_engine->showMessage(errorMessage, LogError); | ||||
|         m_engine->notifyEngineShutdownFailed(); | ||||
|     } | ||||
|     // At this point release interfaces as we might be kept around by the run control. | ||||
|     releaseInterfaces(); | ||||
| } | ||||
|  | ||||
| void CdbEngine::detachDebugger() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user