Singleton destroy


#1

it seems that my singleton class destructor not called automatically when app close.

and i found that i need to call myclass::getInstance()->deleteInstance()  manually.

so i wanna know that is this the normal way to destroy a singleton class?

for now i destory them in the App::shutdown() method.

am i right?

thank you.


#2

You could use DeletedAtShutdown. (But better still: don't use singletons!)


#3

thank you, i'll try that.

so what is the reason that dont' use singletons?

i think one or two in the app should be acceptable right?


#4

Yeah, one or two won't do much harm. It's worth avoiding them where possible though.


#5

got it~~    enlightened