diff --git a/src/consumer.cpp b/src/consumer.cpp index c9efe05a..94dda1c1 100644 --- a/src/consumer.cpp +++ b/src/consumer.cpp @@ -66,6 +66,11 @@ Consumer::Consumer(Configuration config) Consumer::~Consumer() { try { + // make sure to destroy the function closures. in case they hold kafka + // objects, they will need to be destroyed before we destroy the handle + assignment_callback_ = nullptr; + revocation_callback_ = nullptr; + rebalance_error_callback_ = nullptr; close(); } catch (const Exception&) {