From f1da3adbdd88d3c6663092c4dbd01c0ef542b1d9 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sat, 29 Jul 2023 17:44:59 +0000 Subject: [PATCH] Bug 5290: pure virtual call in Ftp::Client constructor (#1429) FATAL: Dying from an exception handling failure; exception: [no active exception] Converting `this` to CbcPointer in a constructor of an abstract class like Ftp::Client does not work because our virtual toCbdata() method remains pure until the final/child class constructor runs. Conceptually, the bug was probably introduced in 2013 commit 434a79b, when FTP class hierarchy grew, making Ftp::Client an abstract class, but the trigger was recent commit 337b9aa that removed CBDATA_CLASS() from Ftp::Client class declaration. We discovered, described, and addressed several such bugs in that commit, but we missed this case. --- src/clients/FtpClient.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/clients/FtpClient.h b/src/clients/FtpClient.h index cbe0e58538..0db3b2da04 100644 --- a/src/clients/FtpClient.h +++ b/src/clients/FtpClient.h @@ -109,6 +109,8 @@ public: /// FTP client functionality shared among FTP Gateway and Relay clients. class Client: public ::Client { + CBDATA_INTERMEDIATE(); + public: explicit Client(FwdState *fwdState); ~Client() override; -- 2.47.2