From 7cb5b985c959f39203afb2e153ade69a778851ed Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 27 Aug 2008 13:39:50 +0200 Subject: [PATCH] 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. --- src/filter_z3950_client.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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(); -- 1.7.10.4