Repair a crash when decoding ISCAT

Passing a  auto stack variable to  a future is  not a good idea  as it
will almost certainly  go out of scope before the  future has finished
executing.
This commit is contained in:
Bill Somerville 2019-06-30 12:17:17 +01:00
parent c65d832356
commit adcf202637
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
subroutine fast_decode(id2,narg,ntrperiod,line,mycall_12, &
subroutine fast_decode(id2,narg,trperiod,line,mycall_12, &
hiscall_12)
parameter (NMAX=30*12000)
@ -6,6 +6,7 @@ subroutine fast_decode(id2,narg,ntrperiod,line,mycall_12, &
integer*2 id2a(NMAX)
integer*2 id2b(NMAX)
integer narg(0:14)
double precision trperiod
real dat(30*12000)
complex cdat(262145),cdat2(262145)
real psavg(450)
@ -41,7 +42,7 @@ subroutine fast_decode(id2,narg,ntrperiod,line,mycall_12, &
nhashcalls=narg(12)
line(1:100)(1:1)=char(0)
if(t0.gt.float(ntrperiod)) go to 900
if(t0.gt.trperiod) go to 900
if(t0.gt.t1) go to 900
if(nmode.eq.102) then
@ -53,7 +54,7 @@ subroutine fast_decode(id2,narg,ntrperiod,line,mycall_12, &
cdat2=cdat
ndat=ndat0
call wav11(id2,ndat,dat)
nzz=11025*ntrperiod
nzz=11025*int(trperiod) !beware if fractional T/R period ever used here
if(ndat.lt.nzz) dat(ndat+1:nzz)=0.0
ndat=min(ndat,30*11025)
call ana932(dat,ndat,cdat,npts) !Make downsampled analytic signal

View File

@ -147,7 +147,7 @@ extern "C" {
float* level, float* sigdb, float* snr, float* dfreq,
float* width);
void fast_decode_(short id2[], int narg[], int* ntrperiod,
void fast_decode_(short id2[], int narg[], double * trperiod,
char msg[], char mycall[], char hiscall[],
fortran_charlen_t, fortran_charlen_t, fortran_charlen_t);
void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
@ -2965,10 +2965,9 @@ void MainWindow::decode() //decode()
narg[12]=0;
narg[13]=-1;
narg[14]=m_config.aggressive();
int nTRperiod=m_TRperiod;
memcpy(d2b,dec_data.d2,2*360000);
watcher3.setFuture (QtConcurrent::run (std::bind (fast_decode_,&d2b[0],
&narg[0],&nTRperiod,&m_msg[0][0],
&narg[0],&m_TRperiod,&m_msg[0][0],
dec_data.params.mycall,dec_data.params.hiscall,8000,12,12)));
} else {
memcpy(to, from, qMin(mem_jt9->size(), size));