I've built easy_profiler (commit 5ee29cdee1a20cac628d04410865df2bf51a8c08 ) on Windows 10 with MinGW 7.3 (from QT)
The build went fine, no error, I can start capturing data, but when I stop the capture I am unable to read it. The profiler_gui crashes
After investigation the error was coming from the destructor of ThreadGuard in (profile_manager.cpp)
The error is strange, the problem is from the order of the if statement. May be a problem with the macro THIS_THREAD.
When I change this
if (m_id != 0 && THIS_THREAD != nullptr && THIS_THREAD->id == m_id)
to that
if (THIS_THREAD != nullptr && m_id != 0 && THIS_THREAD->id == m_id)
It solves the issue
To be specific you cannot call THIS_THREAD != nullptr before m_id != 0, I've tried a nested if and got the same issue
if (m_id != 0)
{
if(THIS_THREAD != nullptr)
{
}
}
Here is the full code of the destructor
profiler::ThreadGuard::~ThreadGuard()
{
#ifndef EASY_PROFILER_API_DISABLED
if (THIS_THREAD != nullptr && m_id != 0 && THIS_THREAD->id == m_id)
{
bool isMarked = false;
EASY_EVENT_RES(isMarked, "ThreadFinished", EASY_COLOR_THREAD_END, profiler::FORCE_ON);
//THIS_THREAD->markProfilingFrameEnded();
THIS_THREAD->putMark();
THIS_THREAD->expired.store(isMarked ? 2 : 1, std::memory_order_release);
THIS_THREAD = nullptr;
}
#endif
}
Hi everyone !
I've built easy_profiler (commit 5ee29cdee1a20cac628d04410865df2bf51a8c08 ) on Windows 10 with MinGW 7.3 (from QT)
The build went fine, no error, I can start capturing data, but when I stop the capture I am unable to read it. The profiler_gui crashes
After investigation the error was coming from the destructor of ThreadGuard in (profile_manager.cpp)
The error is strange, the problem is from the order of the if statement. May be a problem with the macro THIS_THREAD.
When I change this
if (m_id != 0 && THIS_THREAD != nullptr && THIS_THREAD->id == m_id)
to thatif (THIS_THREAD != nullptr && m_id != 0 && THIS_THREAD->id == m_id)
It solves the issueTo be specific you cannot call THIS_THREAD != nullptr before m_id != 0, I've tried a nested if and got the same issue