K_GLOBAL_STATIC

Ian Monroe ian at monroe.nu
Tue Aug 26 17:10:08 CEST 2008


On Tue, Aug 26, 2008 at 8:35 AM, Maximilian Kossick
<maximilian.kossick at googlemail.com> wrote:
> The only way to create singletons that I remember from Amarok1 was this:
>
> static FooBar instance;
> return &instance;
>
> Is that what you mean?

Um no, thats obviously a static object not a static pointer.

I just opened up playlist.h/.cpp from Amarok 1.4 as just a random
singleton, it worked as I described. The ::instance method is limited
to "return s_instance", s_instance is a pointer and s_instance is set
to this in the constructor. So this means the Playlist is manually
constructed at some point, instead of by whatever happens to call
Playlist::instance() first.

>> Which sounds like a more formal way of how we did things in Amarok
>> previously, at least in the MMM-era.
>>
>> It sounds like a neat idea, especially as a way to document all the
>> various systems and their dependencies for old and new Amarok devs.
>
> Yes, I forgot about the dependencies. But what's the MMM-era? Markey,
> mueslie and mxcl?

Yea.


More information about the Amarok-devel mailing list