1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

GLScope: fixed trace memory out of bounds when full history is not complete

This commit is contained in:
f4exb 2015-11-06 08:56:33 +01:00
parent 548b0602fa
commit 3eec09a01f
2 changed files with 13 additions and 3 deletions

View File

@ -103,6 +103,7 @@ private:
int m_sampleRates[16];
BitfieldIndex<m_memHistorySizeLog2> m_memTraceIndex; //!< current index of trace being written
BitfieldIndex<m_memHistorySizeLog2> m_memTraceHistory; //!< trace index shift into history
int m_memTraceIndexMax;
bool m_memTraceRecall;
std::vector<Complex> m_mathTrace;
std::vector<Complex>* m_displayTrace;

View File

@ -23,6 +23,7 @@ GLScope::GLScope(QWidget* parent) :
m_orientation(Qt::Horizontal),
m_memTraceIndex(0),
m_memTraceHistory(0),
m_memTraceIndexMax(0),
m_memTraceRecall(false),
m_displayTrace(&m_rawTrace[0]),
m_oldTraceSize(-1),
@ -197,6 +198,11 @@ void GLScope::newTrace(const std::vector<Complex>& trace, int sampleRate)
m_rawTrace[m_memTraceIndex] = trace;
m_sampleRates[m_memTraceIndex] = sampleRate;
if(m_memTraceIndexMax < (1<<m_memHistorySizeLog2))
{
m_memTraceIndexMax++;
}
//m_sampleRate = sampleRate; // sampleRate comes from scopeVis
m_dataChanged = true;
@ -1928,11 +1934,14 @@ void GLScope::setTriggerPre(Real triggerPre)
}
void GLScope::setMemHistoryShift(int value)
{
if (value < m_memTraceIndexMax)
{
m_memTraceHistory = value;
m_configChanged = true;
update();
}
}
void GLScope::connectTimer(const QTimer& timer)
{