[PyQt] Another wierd bug with QtWebKit
Karthik Tharavaad
karthiktharavaad at gmail.com
Sat Jan 9 20:03:38 GMT 2010
Thanks for replying Phil, thats a great point which I didn't think about.
However 2 points
- Even if the QWebPage does not parent the QNetworkAccessManager, shouldn't
it still hold a reference to it and keep it from getting deleted?
- Even if the behavior is intended, under no circumstances should my
example program1 crash Python.exe the way it does right now. Is there
something wrong with the error handling code?
On Sat, Jan 9, 2010 at 1:33 AM, Phil Thompson
<phil at riverbankcomputing.com>wrote:
> On Fri, 8 Jan 2010 22:54:36 -0800, Karthik Tharavaad
> <karthiktharavaad at gmail.com> wrote:
> > in the same vein as the thread from yesterday. I get an error from this:
> >
> > BEGIN PROGRAM-----------------
> >
> > import sys
> > from PyQt4.QtGui import *
> > from PyQt4.QtCore import *
> > from PyQt4.QtWebKit import QWebView
> > from PyQt4.QtNetwork import QNetworkAccessManager
> >
> > if __name__ == "__main__":
> > app = QApplication(sys.argv)
> > view = QWebView()
> > view.page().setNetworkAccessManager( QNetworkAccessManager() )
> > view.page().mainFrame().load( QUrl("http://www.google.com") )
> > view.show()
> > sys.exit( app.exec_() )
> >
> > ----------------------------------------------
> >
> > This CRASHES upon running, while THIS
> >
> >
> > BEGIN PROGRAM-----------------
> >
> > import sys
> > from PyQt4.QtGui import *
> > from PyQt4.QtCore import *
> > from PyQt4.QtWebKit import QWebView
> > from PyQt4.QtNetwork import QNetworkAccessManager
> >
> > if __name__ == "__main__":
> > app = QApplication(sys.argv)
> > view = QWebView()
> > manager = QNetworkAccessManager() # ADDED LINE, CACHING manager
> > view.page().setNetworkAccessManager(manager)
> > view.page().mainFrame().load( QUrl("http://www.google.com") )
> > view.show()
> > sys.exit( app.exec_() )
> >
> > ----------------------------------------------
> >
> > seems like when I create the QNetworkAccessManager(), it gets destroyed
> > right away after it gets added with setNetworkAccessManager(), however,
> > this
> > should not be the case since QNetworkAccessManager is a QObject and
> should
> > be properly parented to the QWebPage when its added
>
> No it shouldn't. If that were the case how would you use a manager with
> more than one page?
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100109/117597aa/attachment.html>
More information about the PyQt
mailing list