I have webview and a function that waits until a page is loaded like this:

Qt Code:
  1. connect(this, SIGNAL(loadFinished(bool)), &loop, SLOT(quit()));
  2. loop.exec();
  3. while (frame->url().toString().compare(page.toString()) != 0) loop.exec();
To copy to clipboard, switch view to plain text mode 

but if the page is never loaded, and while the event loop is still in exec(), when qApp's quit() is called, the program will hang after the window closed. Shouldn't there be a way to wait for something and allow the application to exit at the same time?