c++ - Qt: Quit application -> checklist for proper clean up -
i have problems close qt applications properly. should 1 take care of when quitting qt::application? want compile check-list can follow exit parts properly, depending functionalities program uses. example, if use qthreads, needs done make sure shut down properly, , on other parts might need special care.
i hope not 1 having such problems , turns out useful many.
there no checklist beyond proper c++ design. qthread
doesn't, unfortunately, offer sane default destruction behaviors. in c++ land, that's nominally no-no. need qobject
owns threads and, before vanishing itself, takes care either quit or terminate them, followed waiting on them before destroyed. same goes classes wrote yourself: must act when destructed. qt acts appropriately when instances of various classes deleted, qthread
standout.
once follow base tenet of c++ design, namely objects release resources upon destruction, won't have problems. use smart pointers, including c++11 if available. qpointer
, qsharedpointer
, qscopedpointer
friends.
Comments
Post a Comment