diff --git a/src/io/pipeer.cpp b/src/io/pipeer.cpp index 6ef8ecea..7942d857 100755 --- a/src/io/pipeer.cpp +++ b/src/io/pipeer.cpp @@ -149,6 +149,13 @@ PIPeer::PIPeer(const PIString & name_): PIObject() { PIPeer::~PIPeer() { destroyed = true; + PIMutexLocker ml(peers_mutex); + piForeach (PeerInfo & p, peers) + if (p._data) { + p._data->dt_in.stop(); + p._data->dt_out.stop(); + p._data->t.stop(true); + } timer.stop(); diag_s.stop(); diag_d.stop(); @@ -161,6 +168,8 @@ PIPeer::~PIPeer() { sendSelfRemove(); destroyMBcasts(); eth_send.close(); + piForeach (PeerInfo & p, peers) + p.destroy(); } diff --git a/src/thread/pitimer.cpp b/src/thread/pitimer.cpp index 2069c04c..d9b755a7 100755 --- a/src/thread/pitimer.cpp +++ b/src/thread/pitimer.cpp @@ -333,7 +333,7 @@ void _PITimerImp_Pool::Pool::add(_PITimerImp_Pool * t) { void _PITimerImp_Pool::Pool::remove(_PITimerImp_Pool * t) { //piCout << "remove ..."; lock(); - to_remove.removeOne(t); + to_remove << t; unlock(); //piCout << "remove done"; }