RFC: singletons and memory management
Ian Monroe
ian at monroe.nu
Thu Sep 11 17:21:57 CEST 2008
On Thu, Sep 11, 2008 at 7:16 AM, Soren Harward <stharward at gmail.com> wrote:
> 3. Though this probably won't ever happen in Amarok, you *must* use a
> static destroy() method which includes properly locking (which I
> haven't shown here) if you have multiple threads that could free the
> singleton, otherwise you could call the destructor twice
> simultaneously and get a segfault when one of them finishes.
>
> And personally speaking, I like the parallelism of the static methods.
> Your constructor and destructor are both private, and you have static
> methods to create and destroy the object.
It seems like a second deconstructor.
Anyways, +1 to what Max said. He has a better solution for all this.
Ian
More information about the Amarok-devel
mailing list