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:
parent
548b0602fa
commit
3eec09a01f
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
@ -1929,9 +1935,12 @@ void GLScope::setTriggerPre(Real triggerPre)
|
||||
|
||||
void GLScope::setMemHistoryShift(int value)
|
||||
{
|
||||
m_memTraceHistory = value;
|
||||
m_configChanged = true;
|
||||
update();
|
||||
if (value < m_memTraceIndexMax)
|
||||
{
|
||||
m_memTraceHistory = value;
|
||||
m_configChanged = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void GLScope::connectTimer(const QTimer& timer)
|
||||
|
Loading…
Reference in New Issue
Block a user