Check default device indices before using them and verify
channel GUI creation succeeds before accessing the result.
Log warnings and return when resources are unavailable to
prevent invalid accesses and improve runtime robustness.
Coverity CIDs: 652207, 652226, 652248, and related findings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
ConfigurationsDialog calls on_configurationLoad_clicked() from both
on_configurationsTree_itemActivated() (double-click or Enter) and accept()
(the OK button), so a double-click followed by OK - or simply a second click on
Load while the first is still running - starts a second LoadConfigurationFSM.
MainWindow::loadConfiguration() had no guard, so the two ran concurrently: the
second FSM's RemoveAllWorkspacesFSM deletes the workspaces, device sets and GUI
widgets the first FSM is still walking, and the first then dereferences freed
objects.
This is easy to hit on first run, where SDRangel populates the bundled example
configurations and opens the Configurations dialog by itself.
The crash site varies with timing and with which configuration is loaded;
QProgressDialog::setLabelText() from LoadConfigurationFSM::loadDeviceSetSettings()
and the Map feature's QQuickWidget have both been observed. Driving the dialog
with two loads reproduced it 3/3; a single load did not crash in 2/2.
Refuse a load while one is in flight. The in-flight FSM is tracked through a
QPointer so an FSM destroyed without finishing cannot wedge configuration
loading permanently.
LoadConfigurationFSM::m_waitBox becomes a QPointer for the same reason: the
progress dialog is created with WA_DeleteOnClose and the FSM outlives it, so the
existing "if (m_waitBox)" checks in the state handlers were testing a pointer
that could already dangle.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GET /sdrangel/windows lists every device, spectrum, channel and feature
window with its workspace, title and whether it is hidden; the workspace
PUTs take a hidden field alongside the index.
The Web API has no access to the GUI, so MainCore keeps a table of what
the GUI has published for each window, keyed by the DeviceAPI,
SpectrumVis, ChannelAPI or Feature it belongs to. The GUI side is a new
WorkspaceWindow base for the four window classes, which publishes on
every show and hide, on a retitle and when the workspaces are renumbered,
and takes the workspace from the window's Workspace ancestor rather than
the plugin's settings, which a settings message from the channel can
reset.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
POST /sdrangel/workspace/{workspaceIndex}/actions with a WorkspaceActions body whose action
is one of cascade, tile, stackVertical, stack, autostack or tab, doing what the workspace
toolbar buttons do. The one-shot arrangements switch tabbed windows off first; autostack and
tab set the corresponding option. The SWG class is written by hand to match the yaml, as the
code generator was not run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Device, spectrum, channel and feature windows gain a hide button beside
the existing ones. A hidden window is still there and still running, it
just takes no screen space, which is the difference between hiding one and
closing it.
The new Window menu brings them back: it lists whatever is currently
hidden, grouped under Devices, Spectrums, Channels and Features, and is
empty when nothing is. It also carries the sub window arrangements that
until now only existed as workspace title bar buttons: cascade, tile,
stack vertically, stack in columns, and tabs.
Those buttons held Ctrl+Shift+C/T/V/S/B, but every workspace's buttons
claimed the same keys, so with more than one workspace the shortcuts were
ambiguous and none of them fired. The menu items take the shortcuts
instead, as application shortcuts since an undocked workspace is a window
of its own, and act on the workspace last worked in. Tabs is per
workspace, so its tick follows whichever workspace that is.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Preserve the configuration and center frequency when recreating or
reloading a device of the same device type.
Save the existing device description, serialized settings, and center
frequency before removing the current device. After creating the
replacement, restore the saved settings and frequency when the device
description matches.
For MIMO devices, preserve and restore both the source (RX) and sink (TX)
center frequencies.
This prevents a device reload from unnecessarily resetting the user's
device configuration. In particular, it allows a device that has entered
an error state and needs to be reloaded to return with its previous
configuration instead of requiring the user to configure it again.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
DSPDevice*Engine: Add signals to indicate when commands have been processed.
DSPDeviceSourceEngine: Fix small memory leak.
DSPEngine::removeDeviceEngineAt: Remove wait to avoid blocking thread. Return QThread to get finished signal.
DSPEngine::addDevice*Engine: Don't call deleteLater for device*Engine, as these objects are deleted manually in MainWindow, which will crash if deleteLater called first.
Settings are saved in MainWindow::closeEvent() which is called when Sdrangel
is exited by closing its main window, or when using the File/Exit menu (or
Ctrl+Q) or when pressing Alt+F4.