diff --git a/src/ca/oldSubscription.cpp b/src/ca/oldSubscription.cpp index 771b5e23f..e5e26d1a9 100644 --- a/src/ca/oldSubscription.cpp +++ b/src/ca/oldSubscription.cpp @@ -39,14 +39,18 @@ void oldSubscription::exception ( int status, const char * /* pContext */, unsigned type, arrayElementCount count ) { - struct event_handler_args args; - - args.usr = this->pPrivate; - args.chid = &this->chan; - args.type = type; - args.count = count; - args.status = status; - args.dbr = 0; - ( *this->pFunc ) ( args ); + if ( status == ECA_CHANDESTROY ) { + delete this; + } + else if ( status != ECA_DISCONN ) { + struct event_handler_args args; + args.usr = this->pPrivate; + args.chid = &this->chan; + args.type = type; + args.count = count; + args.status = status; + args.dbr = 0; + ( *this->pFunc ) ( args ); + } }