diff --git a/src/plugins/debugger/gdb/codagdbadapter.cpp b/src/plugins/debugger/gdb/codagdbadapter.cpp index f354bce1ef8..663d2dcfa72 100644 --- a/src/plugins/debugger/gdb/codagdbadapter.cpp +++ b/src/plugins/debugger/gdb/codagdbadapter.cpp @@ -1297,6 +1297,7 @@ void CodaGdbAdapter::reportRegisters() void CodaGdbAdapter::handleRegisterChildren(const CodaCommandResult &result) { + QTC_ASSERT(m_codaDevice, return); const QByteArray contextId = result.cookie.toByteArray(); if (!result) { logMessage("Error retrieving register children of " + contextId diff --git a/src/shared/symbianutils/codadevice.cpp b/src/shared/symbianutils/codadevice.cpp index 89bffa7eb85..02dec9e1dbd 100644 --- a/src/shared/symbianutils/codadevice.cpp +++ b/src/shared/symbianutils/codadevice.cpp @@ -668,12 +668,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector &toke token, qPrintable(joinByteArrays(tokens))); return 236; } + + CodaSendQueueEntry entry = it.value(); // FIXME: const? + d->m_writtenMessages.erase(it); + // No callback: remove entry from map, happy - const unsigned specialHandling = it.value().specialHandling; - if (!it.value().callback && specialHandling == 0u) { - d->m_writtenMessages.erase(it); + const unsigned specialHandling = entry.specialHandling; + if (!entry.callback && specialHandling == 0u) return 0; - } + // Parse values into JSON QVector values; values.reserve(tokenCount); @@ -685,18 +688,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector &toke } else { qWarning("JSON parse error for reply to command token %d: #%d '%s'", token, i, tokens.at(i).constData()); - d->m_writtenMessages.erase(it); return -1; } } } // Construct result and invoke callback, remove entry from map. - CodaCommandResult result(type, it.value().service, it.value().data, - values, it.value().cookie); + CodaCommandResult result(type, entry.service, entry.data, values, entry.cookie); + if (entry.callback) + entry.callback(result); - if (it.value().callback) - it.value().callback(result); - d->m_writtenMessages.erase(it); return 0; }