RFC: singletons and memory management

Jeff Mitchell kde-dev at emailgoeshere.com
Thu Sep 11 00:37:18 CEST 2008


Soren Harward wrote:
> On Wednesday 10 September 2008 17:38:06 Ian Monroe wrote:
>> if (The::playlistModel() )
>>     The::playlistModel()->something()
> 
> But if The::playlistModel() is just an alias for PlaylistModel::instance() 
> (which it is in every single case that I've looked at so far), then you don't 
> have to check if The::playlistModel() exists, because as soon as you call it, 
> it does.  That's the whole point of a singleton.

And if we're in an instance where the singleton is deleted, and is then
called again via ::instance(), we should really fix that anyways.

--Jeff


More information about the Amarok-devel mailing list