1

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 ?

user63898
  • 29,839
  • 85
  • 272
  • 514
  • You should modify the last line so you print the result of app.exec() in the console before returning. If nothing is printed, then it means that app.exec() doesn't actually return, hence preventing your process from ending. – SirDarius Jun 10 '11 at 07:44

1 Answers1

1

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.

LoSciamano
  • 1,099
  • 10
  • 21