Viladoman/CompileScore

Gatherer::OnCompilerPassEnded - nullptr exception

ikrima opened this issue · 1 comments

Excellent project

TLDR

Noticed this crash on:

FinalizeTU(m_activeTU->timeline.name);

if m_activeTU is null => m_activeTUI->timeline.name will crash. Changed it to

if (m_activeTU && category == CompileCategory::BackEnd)
{ 
  FinalizeTU(m_activeTU->timeline.name);
}

Investigation

Only did a quick perusal. Looks like OnCompilerPassEnded gets called with said translation unit before OnCompilerPassStart() for the backend phase. I added tracepoints around the specific file that causes the crash in the start phase and the finalize phase as I initially thought it might've been prematurely dealloced or removed or something but they were never triggered first

Unsure if a deeper logic error exists or if something else is malformed as i'm not too familiar with build insights or this extensions source code

Wow! Sorry about that crash.
I appreciate your investigation.
Receiving the end event before the start is indeed strange and I was not expecting this at all :/. I am learning build insights too while coding this so there might be some mistakes on my end for sure.

I think your fix is valid to avoid crashing and I will have a look soon as I wanted to extend the MSVC exposed information.