title: Trouble diagnosing segfault in Qt application
body: <p>I have an application using QtWebKit.  It loads URLs and exports some stats on the render trees.  This section of code is causing problems:</p>
  
  <pre><code>...
  if (mPage != 0) {
      disconnectSignals(mPage);
      delete mPage;
  }
  mPage = new Page(); //subclass of QWebPage
  connectSignals(mPage);
  QNetworkRequest req;
  req.setUrl("http://...");
  mPage-&gt;mainFrame()-&gt;load(req, QNetworkAccessManager::GetOperation);
  </code></pre>
  
  <p>The first time the above code runs mPage=0, the page loads fine, and everything else goes as expected.  The second time, it's a pointer to the previously created page, so it gets disconnected and deleted.  After load() returns control to the main event loop, I get a SIGSEGV with the following stack trace.  </p>
  
  <pre><code>#0  0x00007ffff49a1e56 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)          () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #1  0x00007ffff6842972 in QWebFrame::loadFinished(bool) () from /home/ubuntu/3rdparty/qt-    4.8.1/lib/libQtWebKit.so.4
  #2  0x00007ffff6881955 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #3  0x00007ffff6bde3ab in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #4  0x00007ffff6c0ef14 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #5  0x00007ffff6e0183b in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #6  0x00007ffff6e016e8 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #7  0x00007ffff6e01755 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #8  0x00007ffff6e0218c in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtWebKit.so.4
  #9  0x00007ffff49a20c1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #10 0x00007ffff4d72b46 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtNetwork.so.4
  #11 0x00007ffff4de91c5 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtNetwork.so.4
  #12 0x00007ffff49a7286 in QObject::event(QEvent*) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #13 0x00007ffff5243fa4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtGui.so.4
  #14 0x00007ffff5248e23 in QApplication::notify(QObject*, QEvent*) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtGui.so.4
  #15 0x00007ffff498e21c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #16 0x00007ffff4991aba in QCoreApplicationPrivate::sendPostedEvents(QObject*, int,     QThreadData*) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #17 0x00007ffff49bce53 in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #18 0x00007ffff235ba5d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #19 0x00007ffff235c258 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #20 0x00007ffff235c429 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #21 0x00007ffff49bd27f in QEventDispatcherGlib::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #22 0x00007ffff52e78ae in ?? () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtGui.so.4
  #23 0x00007ffff498d002 in QEventLoop::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #24 0x00007ffff498d257 in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /   home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #25 0x00007ffff4991db5 in QCoreApplication::exec() () from /home/ubuntu/3rdparty/qt-4.8.1/lib/libQtCore.so.4
  #26 0x0000000000408ba0 in main (argc=3, argv=&lt;optimized out&gt;) at RenderTreeAnalyzer.cpp:474
  </code></pre>