From 2df7da052abbf1ff304d014904c6dd57431f3c23 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 13 Aug 2009 22:43:21 +0000 Subject: [PATCH] destroy getCallback prior to calling callback in case they delete the channel in the callback --- src/ca/getCallback.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ca/getCallback.cpp b/src/ca/getCallback.cpp index 9ed025c2d..e95433dd5 100644 --- a/src/ca/getCallback.cpp +++ b/src/ca/getCallback.cpp @@ -77,12 +77,17 @@ void getCallback::exception ( args.status = status; args.dbr = 0; caEventCallBackFunc * pFuncTmp = this->pFunc; + // fetch client context and destroy prior to releasing + // the lock and calling cb in case they destroy channel there + this->chan.getClientCtx().destroyGetCallback ( guard, *this ); { epicsGuardRelease < epicsMutex > unguard ( guard ); ( *pFuncTmp ) ( args ); } } - this->chan.getClientCtx().destroyGetCallback ( guard, *this ); + else { + this->chan.getClientCtx().destroyGetCallback ( guard, *this ); + } } void * getCallback::operator new ( size_t ) // X aCC 361