From 3c9a9626913b8384e5894334b5ee290f565fe449 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 23 Apr 2019 11:02:29 +0200 Subject: [PATCH] path: fix initialization and destruction of per-path logger --- lib/path.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/path.cpp b/lib/path.cpp index 448b284d4..86de83b05 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -115,10 +115,11 @@ int path_init(struct path *p) assert(p->state == STATE_DESTROYED); - p->logger = logging.get("path"); + new (&p->logger) Logger; new (&p->received) std::bitset; new (&p->mask) std::bitset; + p->logger = logging.get("path"); ret = vlist_init(&p->destinations); if (ret) @@ -554,7 +555,7 @@ int path_check(struct path *p) if (!node_type(pd->node)->write) { p->logger->error("Destiation node {} is not supported as a sink for path ", node_name(pd->node), path_name(p)); return -1; - } + } } if (!IS_POW2(p->queuelen)) { @@ -722,11 +723,11 @@ int path_destroy(struct path *p) return ret; using bs = std::bitset; - using lg = spdlog::logger; + using lg = std::shared_ptr; p->received.~bs(); p->mask.~bs(); - p->logger->~lg(); + p->logger.~lg(); p->state = STATE_DESTROYED;