From 9381a13388f5b3b6f9bd5717cae441ca04a5c051 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 17 Jan 2018 17:56:01 +0000 Subject: [PATCH] Deallocate the sw array on program exit. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8417 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/plotsave.f90 | 6 +++++- mainwindow.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/plotsave.f90 b/lib/plotsave.f90 index 8db68f97d..438e3af51 100644 --- a/lib/plotsave.f90 +++ b/lib/plotsave.f90 @@ -1,11 +1,15 @@ subroutine plotsave(swide,nw,nh,irow) - parameter (NSMAX=6827,NYMAX=64) real, dimension(:,:), allocatable :: sw real swide(0:nw-1) data nw0/-1/,nh0/-1/ save nw0,nh0,sw + if(irow.eq.-99) then + if(allocated(sw)) deallocate(sw) + return + endif + if(nw.ne.nw0 .or. nh.ne.nh0) then if(nw0.ne.-1) deallocate(sw) allocate(sw(0:nw-1,0:nh-1)) diff --git a/mainwindow.cpp b/mainwindow.cpp index 6c80c79ff..b72f30b98 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -136,6 +136,8 @@ extern "C" { double* sigmaa, double* sigmab, int* irc, int len1); void foxgen_(); + + void plotsave_(float swide[], int* m_w , int* m_h1, int* irow); } int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols @@ -2107,6 +2109,11 @@ void MainWindow::closeEvent(QCloseEvent * e) m_shortcuts.reset (); m_mouseCmnds.reset (); if(m_mode!="MSK144" and m_mode!="FT8") killFile(); + float sw=0.0; + int nw=400; + int nh=100; + int irow=-99; + plotsave_(&sw,&nw,&nh,&irow); mem_jt9->detach(); QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")}; quitFile.open(QIODevice::ReadWrite);