Singleton destroy


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.


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


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?


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


got it~~    enlightened