Index: trunk/BNC/src/bncwindow.cpp
===================================================================
--- trunk/BNC/src/bncwindow.cpp	(revision 5237)
+++ trunk/BNC/src/bncwindow.cpp	(revision 5238)
@@ -2114,4 +2114,8 @@
   }
 
+  if (_postProcessing) {
+    _postProcessing->terminate();
+  }
+
   QMainWindow::closeEvent(event);
 }
Index: trunk/BNC/src/rinex/bncpostprocess.cpp
===================================================================
--- trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 5237)
+++ trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 5238)
@@ -61,4 +61,5 @@
   _corrFile   = 0;
   _pppClient  = 0;
+  _isToBeDeleted = false;
 
   bncSettings settings;
@@ -81,4 +82,5 @@
 ////////////////////////////////////////////////////////////////////////////
 t_postProcessing::~t_postProcessing() {
+  qDebug() << "~t_postProcessing";
   delete _pppClient;
   delete _rnxNavFile;
@@ -135,4 +137,13 @@
 }
 
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_postProcessing::terminate() {
+  _isToBeDeleted = true;
+  if (!isRunning()) {
+    delete this;
+  }
+}
+
 //  
 ////////////////////////////////////////////////////////////////////////////
@@ -193,4 +204,9 @@
 
     for (unsigned iObs = 0; iObs < epo->rnxSat.size(); iObs++) {
+      if (_isToBeDeleted) {
+        QThread::exit(0);
+        this->deleteLater();
+        return;
+      }
 
       const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iObs];
Index: trunk/BNC/src/rinex/bncpostprocess.h
===================================================================
--- trunk/BNC/src/rinex/bncpostprocess.h	(revision 5237)
+++ trunk/BNC/src/rinex/bncpostprocess.h	(revision 5238)
@@ -61,4 +61,5 @@
  public:
   virtual void run();
+  void terminate();
  
  private:
@@ -70,4 +71,5 @@
   QFile*        _outFile;
   QTextStream*  _outStream;
+  bool          _isToBeDeleted;
 };
 
