user63898
user63898

Reputation: 30963

Qt process stays in memory after application closes

i have simple application that start QDialog from its main like this :

int main(int argc, char *argv[])
 {
     Q_INIT_RESOURCE(resources); 
     QApplication app(argc, argv);
     QCoreApplication::setApplicationName(APP_NAME);
     QCoreApplication::setApplicationVersion(APP_VERISON);
     QCoreApplication::setOrganizationDomain(APP_DOMAIN);
     app.setStyle("WindowsXP");    
     QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
     QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

         AuthenticationDialogContainer *pAuthenticationDialogContainer = new AuthenticationDialogContainer();
     if(pAuthenticationDialogContainer->exec() != QDialog::Accepted ) {
         return 0;
     }



     return app.exec();
}

when its pass the end of the application that is after app.exec() and the application doing what is suppose to do . when i open the windows xp task manager i see that the process is still in memory and i need manually kill it . how can i prevent it from happening ?

Upvotes: 1

Views: 738

Answers (1)

LoSciamano
LoSciamano

Reputation: 1119

QDialog::exec is a blocking call: this code show and close the dialog before the QApplication start.
You can use QDialog::show and handle the return code in QDialog::accept method.

Upvotes: 1

Related Questions