From 68aea9c16f29c1276fe0c01ea197df23b72d4890 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 22 Jul 2026 20:37:16 -0400 Subject: [PATCH] RadioAstronomy: Apply channel settings only after dialog acceptance Only apply channel settings after BasicChannelSettingsDialog returns an accepted result. Previously, the return value from dialog.exec() was ignored and settings were copied from the dialog regardless of whether the dialog was accepted or rejected. This could cause changes made in the channel settings dialog to be applied even when the user discarded them. Check the dialog result before updating the channel title, color, Reverse API configuration, and stream index to keep the GUI state synchronized with the user's action. This also fixes the Coverity CHECKED_RETURN warning for the unchecked QDialog::exec() return value. Signed-off-by: Robin Getz --- .../radioastronomy/radioastronomygui.cpp | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 60d36b0d1..0aae52abc 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -2061,31 +2061,32 @@ void RadioAstronomyGUI::onMenuDialogCalled(const QPoint &p) dialog.move(p); new DialogPositioner(&dialog, false); - dialog.exec(); - - m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); - m_settings.m_title = m_channelMarker.getTitle(); - m_settings.m_useReverseAPI = dialog.useReverseAPI(); - m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); - m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); - m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); - m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex(); - - setWindowTitle(m_settings.m_title); - setTitle(m_channelMarker.getTitle()); - setTitleColor(m_settings.m_rgbColor); - - if (m_deviceUISet->m_deviceMIMOEngine) + if (dialog.exec() == QDialog::Accepted) { - m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); - m_channelMarker.clearStreamIndexes(); - m_channelMarker.addStreamIndex(m_settings.m_streamIndex); - updateIndexLabel(); - } + m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); + m_settings.m_title = m_channelMarker.getTitle(); + m_settings.m_useReverseAPI = dialog.useReverseAPI(); + m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); + m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); + m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); + m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex(); + + setWindowTitle(m_settings.m_title); + setTitle(m_channelMarker.getTitle()); + setTitleColor(m_settings.m_rgbColor); + + if (m_deviceUISet->m_deviceMIMOEngine) + { + m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); + m_channelMarker.clearStreamIndexes(); + m_channelMarker.addStreamIndex(m_settings.m_streamIndex); + updateIndexLabel(); + } - applySettings(QStringList({"title", "rgbColor", "useReverseAPI", "reverseAPIAddress", - "reverseAPIPort", "reverseAPIDeviceIndex", "reverseAPIChannelIndex", - "streamIndex"})); + applySettings(QStringList({"title", "rgbColor", "useReverseAPI", "reverseAPIAddress", + "reverseAPIPort", "reverseAPIDeviceIndex", "reverseAPIChannelIndex", + "streamIndex"})); + } } resetContextMenuType();