Make ReBuffer refcount management automatic, using std::shared_ptr:

- No longer need to call setRefCount() / decRefCount()
- Restore old ThreadBlockingQueue using std::deque, for std::shared_ptr correct behaviour.
This commit is contained in:
vsonnier
2017-05-24 12:24:36 +02:00
parent 8776908340
commit 4b323e9863
32 changed files with 289 additions and 409 deletions
+3 -4
View File
@@ -104,7 +104,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
wxPaintDC dc(this);
const wxSize ClientSize = GetClientSize();
ScopeRenderData *avData;
ScopeRenderDataPtr avData;
while (inputData.try_pop(avData)) {
@@ -113,7 +113,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
if (avData->waveform_points.size()) {
scopePanel.setPoints(avData->waveform_points);
}
avData->decRefCount();
} else {
if (avData->waveform_points.size()) {
spectrumPanel.setPoints(avData->waveform_points);
@@ -124,8 +124,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
spectrumPanel.setFFTSize(avData->fft_size);
spectrumPanel.setShowDb(showDb);
}
avData->decRefCount();
}
}
+1 -2
View File
@@ -54,7 +54,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
wxPaintDC dc(this);
const wxSize ClientSize = GetClientSize();
SpectrumVisualData *vData;
SpectrumVisualDataPtr vData;
if (visualDataQueue.try_pop(vData)) {
if (vData) {
@@ -62,7 +62,6 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
spectrumPanel.setPeakPoints(vData->spectrum_hold_points);
spectrumPanel.setFloorValue(vData->fft_floor);
spectrumPanel.setCeilValue(vData->fft_ceiling);
vData->decRefCount();
}
}
+3 -9
View File
@@ -97,7 +97,7 @@ void WaterfallCanvas::processInputQueue() {
if (linesPerSecond) {
if (lpsIndex >= targetVis) {
while (lpsIndex >= targetVis) {
SpectrumVisualData *vData;
SpectrumVisualDataPtr vData;
if (visualDataQueue.try_pop(vData)) {
@@ -106,7 +106,7 @@ void WaterfallCanvas::processInputQueue() {
waterfallPanel.setPoints(vData->spectrum_points);
}
waterfallPanel.step();
vData->decRefCount();
updated = true;
}
lpsIndex-=targetVis;
@@ -915,13 +915,7 @@ void WaterfallCanvas::setLinesPerSecond(int lps) {
linesPerSecond = lps;
//empty all
SpectrumVisualData *vData;
while (visualDataQueue.try_pop(vData)) {
if (vData) {
vData->decRefCount();
}
}
visualDataQueue.flush();
}
void WaterfallCanvas::setMinBandwidth(int min) {