Page MenuHomePhabricator

Implements a virtual destructor on the BaseRequestHandler class.
ClosedPublic

Authored by Fabien on Tue, Jul 9, 07:22.

Details

Summary
Implements a virtual destructor on the BaseRequestHandler class to
protect against undefined behavior in the event that a derived
BaseRequestHandler class has a destructor and an object of such derived
class is destroyed through a pointer to its base class.

Backport of core PR12050
https://github.com/bitcoin/bitcoin/pull/12050/files

Note: the event described above actually occurs.

Test Plan

Build with Clang and check there is no -Wdelete-non-virtual-dtor
warning.

With ASAN enabled:

./test/functional/test_runner.py interface_bitcoin_cli

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Tue, Jul 9, 07:22
Herald added a reviewer: Restricted Project. · View Herald TranscriptTue, Jul 9, 07:22
deadalnix accepted this revision.Tue, Jul 9, 12:17

It's actually a good idea to build with -Wdelete-non-virtual-dtor if the compiler supports it.

This revision is now accepted and ready to land.Tue, Jul 9, 12:17