title: Segmentation fault when assigning cookie jar to QWebView
body: <p>I'm trying to create a cookie jar that is used globally across all windows opened, so that any cookies created are available.  If I right click a link and open in new window then close that window, when I click on a link in the first window, I get segfault.</p>
  
  <p>I would guess this is because it's looking for the cookie jar in the closed window. so any tips on how to implement this properly would be a great start.</p>
  
  <pre><code>from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork
  
  cookies = QtNetwork.QNetworkCookieJar()
  
  class Browser(QtWebKit.QWebView):
      _windows = set()
  
      @classmethod
      def _removeWindow(cls, window):
          if window in cls._windows:
              cls._windows.remove(window)
  
      @classmethod
      def newWindow(cls):
          window = cls()
          cls._windows.add(window)
          return window
  
      def __init__(self, parent=None):
          QtWebKit.QWebView.__init__(self, parent)
          self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
          self.settings().setAttribute(
              QtWebKit.QWebSettings.JavascriptEnabled, True)
          self.settings().setAttribute(
              QtWebKit.QWebSettings.JavascriptCanOpenWindows, True)
          self.page().networkAccessManager().setCookieJar(cookies)
  
      def closeEvent(self, event):
          self._removeWindow(self)
          event.accept()
  
      def createWindow(self, mode):
          window = self.newWindow()
          if mode == QtWebKit.QWebPage.WebModalDialog:
              window.setWindowModality(QtCore.Qt.ApplicationModal)
          window.show()
          return window
  
  if __name__ == '__main__':
      import sys
      app = QtGui.QApplication(sys.argv)
      browser = Browser()
      browser.setUrl(QtCore.QUrl("http://google.com"))
      browser.show()
      sys.exit(app.exec_())
  </code></pre>