Calling functions inside a destructor is commonly not considered a good
practise, as there is the possibility that an exception is thrown. This
leads to not correctly cleaned up memory and the behaviour of exceptions
in the destructor is undefined.
Here is more information about throwing exceptions in the destructor:
SP on throwing in the destructor
In your case, a well defined clean up via a public interface
is a whole better way to go. You could for example provide a Dispose
method that does the clean-up.
Consider something like the following (in pseudocode):
public:
void Dispose()
{
bool isDestructing = true;
functionCall(isDestructing);
}