Skip to content

Commit 6b2208f

Browse files
authored
Fixes a crash related to connection tracker config callbacks (#12209)
1 parent 74aa8e5 commit 6b2208f

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/records/RecCore.cc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,22 +373,17 @@ Enable_Config_Var(std::string_view const &name, RecContextCb record_cb, RecConfi
373373
// the actual callback.
374374
using Context = std::tuple<decltype(record_cb), void *>;
375375

376-
// To deal with process termination cleanup, store the context instances in a deque where
377-
// tail insertion doesn't invalidate pointers. These persist until process shutdown.
378-
static std::deque<Context> storage;
379-
380-
Context &ctx = storage.emplace_back(record_cb, cookie);
376+
Context ctx(record_cb, cookie);
381377
// Register the call back - this handles external updates.
382378
RecRegisterConfigUpdateCb(
383379
name.data(),
384-
[&config_cb](const char *name, RecDataT dtype, RecData data, void *ctx) -> int {
385-
auto &&[context_cb, cookie] = *static_cast<Context *>(ctx);
386-
if ((*context_cb)(name, dtype, data, cookie)) {
380+
[config_cb, record_cb](const char *name, RecDataT dtype, RecData data, void *cookie) -> int {
381+
if (record_cb(name, dtype, data, cookie)) {
387382
config_cb(name, dtype, data, cookie); // Let the caller handle the runtime config update.
388383
}
389384
return REC_ERR_OKAY;
390385
},
391-
&ctx);
386+
cookie);
392387

393388
// Use the record to do the initial data load.
394389
// Look it up and call the updater @a cb on that data.

0 commit comments

Comments
 (0)