Commit cc924c42 authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: codadevice: merge multiple cleanup paths

Change-Id: Ia75a833652d32e2f02ea7ed448561f619d4945cc
Reviewed-on: http://codereview.qt.nokia.com/338

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 12d2a1e8
...@@ -1297,6 +1297,7 @@ void CodaGdbAdapter::reportRegisters() ...@@ -1297,6 +1297,7 @@ void CodaGdbAdapter::reportRegisters()
void CodaGdbAdapter::handleRegisterChildren(const CodaCommandResult &result) void CodaGdbAdapter::handleRegisterChildren(const CodaCommandResult &result)
{ {
QTC_ASSERT(m_codaDevice, return);
const QByteArray contextId = result.cookie.toByteArray(); const QByteArray contextId = result.cookie.toByteArray();
if (!result) { if (!result) {
logMessage("Error retrieving register children of " + contextId logMessage("Error retrieving register children of " + contextId
......
...@@ -668,12 +668,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector<QByteArray> &toke ...@@ -668,12 +668,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector<QByteArray> &toke
token, qPrintable(joinByteArrays(tokens))); token, qPrintable(joinByteArrays(tokens)));
return 236; return 236;
} }
CodaSendQueueEntry entry = it.value(); // FIXME: const?
d->m_writtenMessages.erase(it);
// No callback: remove entry from map, happy // No callback: remove entry from map, happy
const unsigned specialHandling = it.value().specialHandling; const unsigned specialHandling = entry.specialHandling;
if (!it.value().callback && specialHandling == 0u) { if (!entry.callback && specialHandling == 0u)
d->m_writtenMessages.erase(it);
return 0; return 0;
}
// Parse values into JSON // Parse values into JSON
QVector<JsonValue> values; QVector<JsonValue> values;
values.reserve(tokenCount); values.reserve(tokenCount);
...@@ -685,18 +688,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector<QByteArray> &toke ...@@ -685,18 +688,15 @@ int CodaDevice::parseCodaCommandReply(char type, const QVector<QByteArray> &toke
} else { } else {
qWarning("JSON parse error for reply to command token %d: #%d '%s'", qWarning("JSON parse error for reply to command token %d: #%d '%s'",
token, i, tokens.at(i).constData()); token, i, tokens.at(i).constData());
d->m_writtenMessages.erase(it);
return -1; return -1;
} }
} }
} }
// Construct result and invoke callback, remove entry from map. // Construct result and invoke callback, remove entry from map.
CodaCommandResult result(type, it.value().service, it.value().data, CodaCommandResult result(type, entry.service, entry.data, values, entry.cookie);
values, it.value().cookie); if (entry.callback)
entry.callback(result);
if (it.value().callback)
it.value().callback(result);
d->m_writtenMessages.erase(it);
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment