From: Adam Dickmeiss Date: Wed, 27 Aug 2008 11:39:50 +0000 (+0200) Subject: Fixed bug #2229:crash in Z39.50 client module X-Git-Tag: v1.0.15~20 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=7cb5b985c959f39203afb2e153ade69a778851ed;p=metaproxy-moved-to-github.git Fixed bug #2229:crash in Z39.50 client module Fixed bug #2229:crash in Z39.50 client module. The release_assoc method could be deleting the same object twice. --- diff --git a/src/filter_z3950_client.cpp b/src/filter_z3950_client.cpp index 6b27e7e..2294ec0 100644 --- a/src/filter_z3950_client.cpp +++ b/src/filter_z3950_client.cpp @@ -406,17 +406,13 @@ void yf::Z3950Client::Rep::release_assoc(Package &package) { // destroy hint (send_and_receive) it->second->m_destroyed = true; - - // wait until no one is waiting for it. - while (it->second->m_queue_len) - m_cond_session_ready.wait(lock); - - // the Z_Assoc and PDU_Assoc must be destroyed before - // the socket manager.. so pull that out.. first.. - yazpp_1::SocketManager *s = it->second->m_socket_manager; - delete it->second; // destroy Z_Assoc - delete s; // then manager - m_clients.erase(it); + if (it->second->m_queue_len == 0) + { + yazpp_1::SocketManager *s = it->second->m_socket_manager; + delete it->second; // destroy Z_Assoc + delete s; // then manager + m_clients.erase(it); + } } yaz_log(YLOG_LOG, "Notify all release_assoc"); m_cond_session_ready.notify_all();