kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Fix PSK viewer crash
The psk ctor was calling psk::restart() which in turn called the global pskviewer's restart(), possibly deallocating memory in use by another psk instance. This would happen when changing PSK modes with the Viewer window visible, as a new modem is constructed before the old one is destroyed. Add a psk class viewpsk member and make the global pskviewer point to it.pull/2/head
rodzic
708ac48c3f
commit
433a3c5629
|
@ -31,6 +31,8 @@
|
|||
#include "filters.h"
|
||||
#include "pskcoeff.h"
|
||||
#include "pskvaricode.h"
|
||||
#include "viewpsk.h"
|
||||
#include "pskeval.h"
|
||||
|
||||
//=====================================================================
|
||||
#define PskSampleRate (8000)
|
||||
|
@ -87,6 +89,9 @@ private:
|
|||
complex quality;
|
||||
int acquire;
|
||||
|
||||
viewpsk* pskviewer;
|
||||
pskeval* evalpsk;
|
||||
|
||||
void rx_symbol(complex symbol);
|
||||
void rx_bit(int bit);
|
||||
void rx_qpsk(int bits);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "trx.h"
|
||||
#include "filters.h"
|
||||
#include "fldigi-config.h"
|
||||
#include "pskeval.h"
|
||||
|
||||
//=====================================================================
|
||||
#define VPSKSAMPLERATE (8000)
|
||||
|
@ -69,6 +70,8 @@ private:
|
|||
time_t now;
|
||||
time_t timeout[MAXCHANNELS];
|
||||
|
||||
pskeval* evalpsk;
|
||||
|
||||
void rx_symbol(int ch, complex symbol);
|
||||
void rx_bit(int ch, int bit);
|
||||
|
||||
|
@ -76,7 +79,7 @@ private:
|
|||
void afc(int);
|
||||
|
||||
public:
|
||||
viewpsk(trx_mode mode);
|
||||
viewpsk(pskeval* eval, trx_mode mode);
|
||||
~viewpsk();
|
||||
void init();
|
||||
void restart(trx_mode mode);
|
||||
|
|
|
@ -60,7 +60,6 @@ extern waterfall *wf;
|
|||
|
||||
char pskmsg[80];
|
||||
viewpsk *pskviewer = (viewpsk *)0;
|
||||
pskeval *evalpsk = (pskeval *)0;
|
||||
|
||||
void psk::tx_init(SoundBase *sc)
|
||||
{
|
||||
|
@ -92,9 +91,7 @@ void psk::rx_init()
|
|||
|
||||
void psk::restart()
|
||||
{
|
||||
if (!pskviewer) pskviewer = new viewpsk(mode);
|
||||
else pskviewer->restart(mode);
|
||||
if (!evalpsk) evalpsk = new pskeval;
|
||||
pskviewer->restart(mode);
|
||||
evalpsk->setbw(bandwidth);
|
||||
}
|
||||
|
||||
|
@ -118,6 +115,10 @@ psk::~psk()
|
|||
if (fir2) delete fir2;
|
||||
if (snfilt) delete snfilt;
|
||||
if (imdfilt) delete imdfilt;
|
||||
if (::pskviewer == pskviewer)
|
||||
::pskviewer = 0;
|
||||
delete pskviewer;
|
||||
delete evalpsk;
|
||||
}
|
||||
|
||||
psk::psk(trx_mode pskmode) : modem()
|
||||
|
@ -235,7 +236,10 @@ psk::psk(trx_mode pskmode) : modem()
|
|||
syncbuf[i] = 0.0;
|
||||
E1 = E2 = E3 = 0.0;
|
||||
acquire = 0;
|
||||
|
||||
|
||||
evalpsk = new pskeval;
|
||||
::pskviewer = pskviewer = new viewpsk(evalpsk, mode);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,20 +43,20 @@
|
|||
#include "qrunner.h"
|
||||
|
||||
extern waterfall *wf;
|
||||
extern pskeval *evalpsk;
|
||||
|
||||
//=====================================================================
|
||||
// Change the following for DCD low pass filter adjustment
|
||||
#define SQLCOEFF 0.01
|
||||
//=====================================================================
|
||||
|
||||
viewpsk::viewpsk(trx_mode pskmode)
|
||||
viewpsk::viewpsk(pskeval* eval, trx_mode pskmode)
|
||||
{
|
||||
for (int i = 0; i < MAXCHANNELS; i++) {
|
||||
fir1[i] = (C_FIR_filter *)0;
|
||||
fir2[i] = (C_FIR_filter *)0;
|
||||
}
|
||||
|
||||
|
||||
evalpsk = eval;
|
||||
viewmode = MODE_PREV;
|
||||
restart(pskmode);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue