[Qt-interest] Cleanly exit Qt app with <CTRL-C> from Linux console

Markus Franke Franke.M at sebakmt.com
Thu Dec 23 11:55:56 CET 2010


Dear all,

during system development I am running my Qt application from a console. 

If I press <CTRL-C> within the console a SIGINT is sent to the application 
which is catched by a signal handler. From within this signal handler I am 
calling QApplication::exit(0) which in turn calls the Destructor of my 
main QApplication object. 

>From time to time I observe that the application hangs for about 30 
seconds just at the last line of my main() function which returns the 
return value of QApplication::exec(). (see code below)

---snip---
int main(int argc, char *argv[])
{
    Application* app = new Application(argc, argv);

    int ret = app->exec();

    delete app;

    qDebug("This line is still reached");
    return ret; // this line is hanging for about 30 seconds
}
---snap---

Is there anything else which I have to take care off if I want to exit my 
application via <CTRL-C>?


Thanks in advance and with best regards,
Markus


"Disclaimer: This message is intended only for the use of the individual 
or entity to
which it is addressed and may contain information which is privileged, 
confidential, proprietary,
or exempt from disclosure under applicable law. If you are not the 
intended recipient or the person
responsible for delivering the message to the intended recipient, you are 
strictly prohibited from
disclosing, distributing, copying, or in any way using this message. If 
you have received this 
communication in error, please notify the sender and destroy and delete 
any copies you may have
received."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101223/23ecea5b/attachment.html 


More information about the Qt-interest-old mailing list