diff --git a/src/std/filters/arr.c b/src/std/filters/arr.c index bc0fb3609..bc063e1ea 100644 --- a/src/std/filters/arr.c +++ b/src/std/filters/arr.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -105,9 +106,10 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) { nSource > 1 && (prset = dbGetRset(&chan->addr)) && prset->get_array_info) { + prec = dbChannelRecord(chan); + dbScanLock(prec); status = prset->get_array_info(&chan->addr, &nSource, &offset); nTarget = wrapArrayIndices(&start, my->incr, &end, nSource); - prec = dbChannelRecord(chan); pfl->type = dbfl_type_ref; pfl->stat = prec->stat; pfl->sevr = prec->sevr; @@ -124,6 +126,7 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) { dbExtractArrayFromRec(&chan->addr, pdst, nTarget, nSource, offset, my->incr); pfl->u.r.field = pdst; } + dbScanUnlock(prec); } /* Extract from buffer */ diff --git a/src/std/filters/ts.c b/src/std/filters/ts.c index 5bf2d4898..556679a46 100644 --- a/src/std/filters/ts.c +++ b/src/std/filters/ts.c @@ -14,6 +14,7 @@ #include #include +#include #include static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) { @@ -22,7 +23,9 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) { /* If string or array, must make a copy (to ensure coherence between time and data) */ if (pfl->type == dbfl_type_rec) { + dbScanLock(dbChannelRecord(chan)); dbChannelMakeArrayCopy(pvt, pfl, chan); + dbScanUnlock(dbChannelRecord(chan)); } pfl->time = now;