Index: trunk/BNC/src/PPP/pppClient.cpp
===================================================================
--- trunk/BNC/src/PPP/pppClient.cpp	(revision 5757)
+++ trunk/BNC/src/PPP/pppClient.cpp	(revision 5758)
@@ -40,4 +40,5 @@
  * -----------------------------------------------------------------------*/
 
+#include <QThreadStorage>
 
 #include <iostream>
@@ -61,7 +62,13 @@
 using namespace std;
 
-// Global Variable
-//////////////////////////////////////////////////////////////////////////////
-t_pppClient* PPP_CLIENT = 0;
+// Global variable holding thread-specific pointers
+//////////////////////////////////////////////////////////////////////////////
+QThreadStorage<t_pppClient*> CLIENTS;
+
+// Static function returning thread-specific pointer
+//////////////////////////////////////////////////////////////////////////////
+t_pppClient* t_pppClient::instance() {
+  return CLIENTS.localData();
+}
 
 // Constructor
@@ -76,4 +83,5 @@
   _staRover = new t_station();
   _filter   = new t_filter();
+  CLIENTS.setLocalData(this);
 }
 
@@ -81,4 +89,5 @@
 //////////////////////////////////////////////////////////////////////////////
 t_pppClient::~t_pppClient() {
+  cout << "~t_pppClient" << endl;
   delete _log;
   delete _opt;
Index: trunk/BNC/src/PPP/pppClient.h
===================================================================
--- trunk/BNC/src/PPP/pppClient.h	(revision 5757)
+++ trunk/BNC/src/PPP/pppClient.h	(revision 5758)
@@ -40,4 +40,6 @@
   t_options*          _opt; 
 
+  static t_pppClient* instance();
+
  private:
   void initOutput(t_output* output);
@@ -67,11 +69,11 @@
 }; // namespace BNC
 
-/// Pointer to the main object
-extern BNC::t_pppClient* PPP_CLIENT;
+// Pointer to the main object (thread-specific)
+#define PPP_CLIENT (BNC::t_pppClient::instance())
 
-/// Log stream abbreviation
+// Log stream abbreviation
 #define LOG (*PPP_CLIENT->_log)
 
-/// Options abbreviation
+// Options abbreviation
 #define OPT (PPP_CLIENT->_opt)
 
Index: trunk/BNC/src/PPP/pppThread.cpp
===================================================================
--- trunk/BNC/src/PPP/pppThread.cpp	(revision 5757)
+++ trunk/BNC/src/PPP/pppThread.cpp	(revision 5758)
@@ -110,5 +110,5 @@
 ////////////////////////////////////////////////////////////////////////////
 t_pppRun::~t_pppRun() {
-  delete _pppClient;
+  ////  delete _pppClient;
   cout << "~t_pppRun" << endl;
 }
