title: Why can't I use QMessageBox in QApplication::notify() derived method
body: <p>As I understand it, the way to handle exceptions happening inside the event loop in Qt is to override QApplication::notify() and handle it there. I have tried that and it works:</p>
  
  <pre><code>class Application : public QApplication
  {
      Q_OBJECT
  public:
      explicit Application( int&amp; argc, char** argv );
  
      // override to handle out of memory exceptions
      bool notify( QObject* receiver, QEvent* e );
  
  signals:
  
  public slots:
  
  private:
  
      char* m_buffer;
  };
  
  Application::Application(int &amp;argc, char **argv)
      :QApplication( argc, argv )
  {
      m_buffer = new char[1024*1024];
  }
  
  bool Application::notify(QObject *receiver, QEvent *e)
  {
      try
      {
          return QApplication::notify( receiver, e );
      }
      catch( std::bad_alloc&amp; )
      {
          if ( m_buffer )
          {
              delete[] m_buffer;
              m_buffer = NULL;
          }
  
          // calling QMessageBox from here doesn't work
          // even if release a load of reserved memory
          // don't know why
          QMessageBox::critical( NULL, "Exception", "Application out of memory" );
      }
  </code></pre>
  
  <p>But the message box is blank when it appears (i.e. not rendered correctly). I thought perhaps the process didn't have enough memory. So I tried allocating 1MB of memory at the start (see m_buffer above) and then releasing it before the QMessageBox displayed. But that didn't work either. Any ideas?</p>