From a2ec9734f8b39710169a7a5f20b65f681053fcea Mon Sep 17 00:00:00 2001 From: SomeAlphabetGuy Date: Tue, 4 Jul 2023 14:39:08 -0700 Subject: [PATCH] Added a virtual destructor to Sampler Any superclass that has virtual methods should also have a virtual destructor, otherwise there's a risk of undefined behavior (if an object of a subclass is deleted through a pointer to the superclass). --- src/colmap/optim/sampler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/colmap/optim/sampler.h b/src/colmap/optim/sampler.h index 4f97ae03d5..e0adb78359 100644 --- a/src/colmap/optim/sampler.h +++ b/src/colmap/optim/sampler.h @@ -44,6 +44,7 @@ class Sampler { public: Sampler() = default; explicit Sampler(const size_t num_samples); + virtual ~Sampler() = default; // Initialize the sampler, before calling the `Sample` method. virtual void Initialize(const size_t total_num_samples) = 0;