Fix potential crash on capture close accessing bad data

* Also added some conservative error checking on looking up chunk names.
This commit is contained in:
baldurk
2024-02-13 12:37:05 +00:00
parent 8d8b76ead7
commit 874920bc38
2 changed files with 21 additions and 2 deletions
+2 -1
View File
@@ -7017,7 +7017,8 @@ void BufferViewer::SetMeshFilter(MeshFilter filter, uint32_t taskGroup, uint32_t
break;
}
OnEventChanged(m_Ctx.CurEvent());
if(m_Ctx.IsCaptureLoaded())
OnEventChanged(m_Ctx.CurEvent());
}
void BufferViewer::on_rowOffset_valueChanged(int value)
+19 -1
View File
@@ -1166,6 +1166,9 @@ private:
if(eid == 0)
return tr("Capture Start");
if(eid >= m_Actions.size())
return QVariant();
const ActionDescription *action = m_Actions[eid];
QString name;
@@ -1199,7 +1202,16 @@ private:
{
const APIEvent &e = *eidit;
const SDChunk *chunk = m_Ctx.GetStructuredFile().chunks[e.chunkIndex];
const StructuredChunkList &chunks = m_Ctx.GetStructuredFile().chunks;
if(e.chunkIndex >= chunks.size())
return QVariant();
const SDChunk *chunk = chunks[e.chunkIndex];
if(chunk == NULL)
return QVariant();
name = chunk->name;
// don't display any "ClassName::" prefix. We keep it for the API inspector which is more
@@ -5618,11 +5630,17 @@ APIEvent EventBrowser::GetAPIEventForEID(uint32_t eid)
const ActionDescription *EventBrowser::GetActionForEID(uint32_t eid)
{
if(!m_Ctx.IsCaptureLoaded())
return NULL;
return m_Model->GetActionForEID(eid);
}
rdcstr EventBrowser::GetEventName(uint32_t eid)
{
if(!m_Ctx.IsCaptureLoaded())
return rdcstr();
return m_Model->GetEventName(eid);
}