Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program crashes (Core Dump) when trying to add a Frequency Scanner channel #2262

Closed
jtaylor2 opened this issue Sep 30, 2024 · 3 comments
Closed
Assignees
Labels

Comments

@jtaylor2
Copy link

Program crashes when trying to add a Frequency Scanner channel to the opened program.
Or if the last closed program was from before the bug and had a Frequency Scanner channel it crashes on startup until the saved configuration is deleted.

Self compiled master on openSUSE Leap 15.6
Qt - 5.15.12 gcc11-c++ - 11.3.0

Git bisect says bad commit is [d2e89b7] Fix PR comments

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[d2e89b7] Fix PR comments

gdb
Thread 73 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff73fff6c0 (LWP 27561)]
0x00007fffb0ca9968 in FreqScanner::calcScannerSampleRate(int, int, int&, int&, int&) ()
from /home/jim/download/radio/sdrangel/sdrangel/build/lib/plugins/libfreqscanner.so

@jtaylor2
Copy link
Author

jtaylor2 commented Oct 3, 2024

Backing out the changes in this diff seems to correct the problem, but my 1970's K&R C experience doesn't give me the ability to fix the intent of the original change.

diff --git a/plugins/channelrx/freqscanner/freqscanner.cpp b/plugins/channelrx/freqscanner/freqscanner.cpp
index 48708d72a..e5d62b59f 100644
--- a/plugins/channelrx/freqscanner/freqscanner.cpp
+++ b/plugins/channelrx/freqscanner/freqscanner.cpp
@@ -153,7 +153,7 @@ void FreqScanner::start()
 
     qDebug("FreqScanner::start");
     m_thread = new QThread();
-    m_basebandSink = new FreqScannerBaseband();
+    m_basebandSink = new FreqScannerBaseband(this);
     m_basebandSink->setFifoLabel(QString("%1 [%2:%3]")
         .arg(m_channelId)
         .arg(m_deviceAPI->getDeviceSetIndex())
diff --git a/plugins/channelrx/freqscanner/freqscannerbaseband.cpp b/plugins/channelrx/freqscanner/freqscannerbaseband.cpp
index 4fd211e2b..30357b2a4 100644
--- a/plugins/channelrx/freqscanner/freqscannerbaseband.cpp
+++ b/plugins/channelrx/freqscanner/freqscannerbaseband.cpp
@@ -27,7 +27,9 @@
 
 MESSAGE_CLASS_DEFINITION(FreqScannerBaseband::MsgConfigureFreqScannerBaseband, Message)
 
-FreqScannerBaseband::FreqScannerBaseband() :
+FreqScannerBaseband::FreqScannerBaseband(FreqScanner *freqScanner) :
+    m_freqScanner(freqScanner),
+    m_sink(),
     m_messageQueueToGUI(nullptr)
 {
     qDebug("FreqScannerBaseband::FreqScannerBaseband");
diff --git a/plugins/channelrx/freqscanner/freqscannerbaseband.h b/plugins/channelrx/freqscanner/freqscannerbaseband.h
index 5a832ff41..2fcdc2d7a 100644
--- a/plugins/channelrx/freqscanner/freqscannerbaseband.h
+++ b/plugins/channelrx/freqscanner/freqscannerbaseband.h
@@ -63,7 +63,7 @@ public:
         { }
     };
 
-    FreqScannerBaseband();
+    FreqScannerBaseband(FreqScanner *freqScanner);
     ~FreqScannerBaseband();
     void reset();
     void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);

@f4exb
Copy link
Owner

f4exb commented Oct 3, 2024

Probably this PR deserves a second look

m_freqScanner is uninitialized but used in the code so this is obviously wrong. I am afraid this PR contains similar bugs for other plugins.

@f4exb f4exb self-assigned this Oct 3, 2024
@f4exb f4exb added the bug label Oct 3, 2024
@f4exb
Copy link
Owner

f4exb commented Oct 3, 2024

After double checking only the Frequency Scanner has this bug. I think the cleanup went a bit too far there where it is justified for other plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants