Explicitly delete the copy constructor and copy assignment operator for
DeviceSet, which manages device and channel state that should not be
duplicated through implicit shallow copies.
The implicitly generated copy operations could duplicate internal state and
resource references, potentially causing inconsistent device state or
invalid resource ownership.
Since DeviceSet is not intended to be copied or assigned, prohibit both
operations at compile time to prevent unsafe duplication.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the spectrum visualizer pointer before the device type determines
whether a SpectrumVis instance is created. This ensures unsupported or
unexpected device types leave the member in a defined state.
Found by Coverity (UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Removing a channel's sink or source from a device engine was a queued
message, so a channel could be deleted while the engine thread was
still feeding it. When the caller is deleting, the removal now runs on
the engine thread and is waited for, provided that thread is running
and is not the caller. The MIMO engine gains the same deleting flag and
does the same for its MIMO channels.
ScopeVis and GLScope now attach and detach under the vis mutex and each
clears the other on destruction, as SpectrumVis and GLSpectrum already
do, so a scope window closing while its channel is still running no
longer leaves a dangling pointer on either side.
Also drops an unused variable in GLSpectrumView::paintGL.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GET .../spectrum/history reads the history the spectrum display keeps
for scrolling and reports, over the last seconds and a frequency range
reduced to bins, the per bin maximum, mean and occupancy against a
floor taken as the median of the per bin means, and the signals: each
run of bins above the threshold with its frequency, width, peak, duty
cycle and first and last seen. GET .../spectrum/history/image renders
the same history as a greyscale PNG with its extents in headers.
GLSpectrumInterface gains getSpectrumHistory, which GLSpectrumView
answers from its scroll buffer under its mutex, folding consecutive
rows together by maximum so that at most the rows asked for span the
whole period, since every FFT is a row. Rows taken at another centre or
rate are skipped and counted.
SpectrumVis reads the display while holding its mutex, so the display
is now attached and detached under it, and each side clears the other
on destruction.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Server side for the spectrum paths added to the spec: GET spectrum/report
returns whichever measurement is switched on, POST spectrum/actions
carries autoscale, clearSpectrum, resetMeasurements, freeze and
gotoMarker, and GET spectrum/data returns the power values reduced to a
number of bins. The display actions reach the spectrum through new
GLSpectrumInterface methods that default to doing nothing, so an instance
without a GUI ignores them rather than every caller having to know.
The measurement results are kept as plain values behind a lock and
published once per displayed frame, so a report costs nothing until one is
asked for, and the figures match what is on screen.
Also completes the main spectrum settings, which were only partly carried
over the API, and adds reports that had no way to be read at all: vessels
for AIS, stations for APRS, sondes for Radiosonde, the programme list for
DAB, the RDS programme service name for BFM, and validity flags for the
ADS-B aircraft report so a caller can tell a missing position from one at
zero. Map settings are exposed through their generated setters.
Two fixes found while testing: the frequency scanner dropped the frequency
list because the API calls it "frequencies" and everything downstream
keys it as "frequencySettings", and the spectrum adapters bound a
reference to the error message before init() had allocated one, so every
error path returned no response at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fix cppcheck warning:
Using iterator to member container 'm_sinkBuddies' that may be invalid
clearBuddiesLists() was iterating directly over m_sourceBuddies and
m_sinkBuddies while calling removeBuddy(), which modifies the buddy
relationship lists. This could invalidate the active iterator and result in
undefined behavior.
The issue could lead to intermittent failures during buddy cleanup operations,
such as device removal, device reload, or application shutdown, depending on
container state and timing.
Iterate over copies of the buddy lists so that removing relationships does not
affect the iterators used for traversal.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
In std::vector<T,Allocator>::erase, The iterator pos must be valid and
dereferenceable. Thus the end() iterator (which is valid, but is not
dereferenceable) cannot be used as a value for pos.
Protect against that by checking the result of std::find() before erasing
a buddy entry. The buddy should always be present when removeBuddy() is
called, but avoid undefined behavior if that assumption is violated.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Previously, devices claimed by another device set were omitted from the
device selection lists. Display these devices as disabled and marked
"[in use]" instead of hiding them.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fixes:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7eff8bcf46c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
#1 0x7eff897b484d in DeviceUserArgs::serialize() const sdrbase/device/deviceuserargs.cpp:43
#2 0x7eff897f4904 in MainSettings::save() const sdrbase/settings/mainsettings.cpp:237
#3 0x7eff8b578654 in MainWindow::closeEvent(QCloseEvent*) sdrgui/mainwindow.cpp:1749
#4 0x7eff877a5dc7 in QWidget::event(QEvent*) (/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1a5dc7) (BuildId: 983eca66d9695a1892aa796da4160d8d6f9b9ac4)
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7eff8bcf46c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
#1 0x7eff897b484d in DeviceUserArgs::serialize() const sdrbase/device/deviceuserargs.cpp:43
#2 0x7eff897f4904 in MainSettings::save() const sdrbase/settings/mainsettings.cpp:237
#3 0x7eff8b552c9a in MainWindow::~MainWindow() sdrgui/mainwindow.cpp:326
#4 0x564e8b36e1e5 in runQtApplication app/main.cpp:212
#5 0x564e8b36bab7 in main app/main.cpp:248
#6 0x7eff862456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
(Possibly need to add a mutex for MainCore::getPluginManager, so only
can be used by one thread)
Add option to automatically update My Position based on GPS. This is
started in MainCore, so we get position as soon as possible.
Don't set QFileDialog::DontUseNativeDialog on Android, as Qt's file
dialog can't access user storage. Set globally for Linux/Windows, rather
than for each dialog.
MainWindow:
- Add welcome dialog for Android.
- Don't show menu bar or status bar on Android to save screen space.
- On Android, change tab position when screen orientation changes.
- Load default configurations and presets first time SDRangel is run.
- Change loadConfiguration to use a QProgressDialog rather than
QMessageBox, as the latter was crashing on Android.
- Use DialogPositioner to ensure dialogs are on screen.