diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 6328ba9c..a3c183df 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -4374,11 +4374,14 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, } else if(strcasecmp("trace", argv[1]) == 0) { if (argc > 2 && strcasecmp("on", argv[2]) == 0) { - self->trace = pCon; + self->trace = SCCopyConnection(pCon); SCWrite(pCon, "TRACE ON", eValue); } else { - self->trace = 0; + if (self->trace) { + SCDeleteConnection(self->trace); + self->trace = 0; + } SCWrite(pCon, "TRACE OFF", eValue); } return 1;