{auto} improve the tagger destructor to also unset the onAck() and onNack() callbacks

This commit is contained in:
Emiel Bruijntjes 2022-09-11 20:17:53 +02:00
parent c93f2d89ac
commit b893755293
1 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,15 @@ Tagger::~Tagger()
{
// restore the error-callback
_implementation->onError(nullptr);
// also unset the callbacks for onAck and onNack
auto *deferred = _implementation->confirm();
// unlikely case that the onAck and onNack are not set
if (deferred == nullptr) return;
// unset the callbacks
deferred->onAck(nullptr).onNack(nullptr);
}
/**