On Wed, 11 Sep 2024 16:04:51 -0400, Louis-Philippe Véronneau wrote:

> Lintian::Storage::MLDBM, which defines a `create` and a `DESTROY` function,
> is used by Lintian::Index::Elf.

Actually DEMOLISH.
 
> The latter has `elf_storage` and `elf_storage_by_member` functions, that do
> call the `create` function, but never the `DESTROY` one.

Lintian::Storage::MLDBM uses the Moo object system, which provides
the DEMOLISH method (man 3 Moo):

   DEMOLISH
         sub DEMOLISH {
           my ($self, $in_global_destruction) = @_;
           ...
         }
       
       When  an object is destroyed, any "DEMOLISH" methods in the
       inheritance hierarchy will be called on the object. They are
       given boolean to inform them if global destruction is in
       progress, and are called from the child class upwards to the
       parent. This is similar to "BUILD" methods but in the opposite
       order.

Now the interesting question is why this doesn't happen …

> A good design would have the `DESTROY` function be called automatically at
> when that storage isn't needed anymore, instead of people having to manually
> call it once they are done in their check.

And that seems to be the intention of current code …


Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   

Attachment: signature.asc
Description: Digital Signature

Reply via email to