diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index d8506fcaeb..55b161d28b 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -6483,9 +6483,8 @@ void JReplicator::freeEngineData(Firebird::CheckStatusWrapper* user_status) try { - AutoPtr cleanupApplier(applier); - cleanupApplier->shutdown(tdbb); - fb_assert(!applier); + applier->shutdown(tdbb); + applier = nullptr; } catch (const Exception& ex) { @@ -7650,10 +7649,7 @@ void release_attachment(thread_db* tdbb, Jrd::Attachment* attachment, XThreadEns attachment->att_dsql_instance->dbb_statement_cache->shutdown(tdbb); while (attachment->att_repl_appliers.hasData()) - { - AutoPtr cleanupApplier(attachment->att_repl_appliers.pop()); - cleanupApplier->shutdown(tdbb); - } + attachment->att_repl_appliers.pop()->shutdown(tdbb); if (dbb->dbb_crypto_manager) dbb->dbb_crypto_manager->detach(tdbb, attachment); diff --git a/src/jrd/replication/Applier.cpp b/src/jrd/replication/Applier.cpp index de4962dbab..8fa9f3f6cc 100644 --- a/src/jrd/replication/Applier.cpp +++ b/src/jrd/replication/Applier.cpp @@ -285,6 +285,8 @@ void Applier::shutdown(thread_db* tdbb) m_interface->resetHandle(); m_interface = nullptr; } + + delete this; } void Applier::process(thread_db* tdbb, ULONG length, const UCHAR* data)