Index: /trunk/BNS/bns.cpp
===================================================================
--- /trunk/BNS/bns.cpp	(revision 762)
+++ /trunk/BNS/bns.cpp	(revision 763)
@@ -37,7 +37,16 @@
 ////////////////////////////////////////////////////////////////////////////
 t_bns::~t_bns() {
-  _bnseph->terminate();
-  _bnseph->wait();
-  delete _bnseph;
+  deleteBnsEph();
+}
+
+// Delete bns thread
+////////////////////////////////////////////////////////////////////////////
+void t_bns::deleteBnsEph() {
+  if (_bnseph) {
+    _bnseph->terminate();
+    _bnseph->wait();
+    delete _bnseph; 
+    _bnseph = 0;
+  }
 }
 
@@ -53,4 +62,5 @@
 void t_bns::slotError(const QByteArray msg) {
   cerr << msg.data() << endl;
+  deleteBnsEph();
   emit(error(msg));
 }
Index: /trunk/BNS/bns.h
===================================================================
--- /trunk/BNS/bns.h	(revision 762)
+++ /trunk/BNS/bns.h	(revision 763)
@@ -23,4 +23,5 @@
 
  private:
+  void deleteBnsEph();
   t_bnseph* _bnseph;
   QMutex    _mutex;
