[PyQt] QtWebKit segfault if libflashplayer.so is in plugin searchpath
Robin Wittler
real at the-real.org
Tue Jun 22 21:51:02 BST 2010
Hello,
if i execute the following short script and
./mozilla/plugins/libflashplayer.so exists, there will be a segfault.
(process:9213): GLib-GObject-CRITICAL **:
/build/buildd-glib2.0_2.24.1-1-i386-84Pp4V/glib2.0-2.24.1/gobject/gtype.c:2706:
You forgot to call g_type_init()
(process:9213): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed
(process:9213): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed
syslog says:
Jun 22 22:08:45 wtf kernel: [286355.647328] python[9213]: segfault at 28
ip b18415f5 sp bf9666a0 error 6 in
libgdk_pixbuf-2.0.so.0.2000.1[b183b000+18000]
If i rename libflashplayer.so to libflashplayer.so.bak all is ok and the
website will load. There is also no problem with gnash (the opensource
flash variant).
I have tested this with the gtk implementation of webkit, works as it
should. (see other script below)
PyQt4 Version is 4,7,3
sip version is 4.10.2
Maybe someone here could help me with this.
cheers,
Robin
########################################################################
#PyQt4 Script
########################################################################
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4 import QtWebKit
class Page(QtWebKit.QWebPage):
def __init__(self, **kargs):
QtWebKit.QWebPage.__init__(self)
self.settings().setAttribute(
QtWebKit.QWebSettings.JavascriptEnabled,
kargs.get('JavascriptEnabled', False)
)
self.settings().setAttribute(
QtWebKit.QWebSettings.JavaEnabled,
kargs.get('JavaEnabled', False)
)
self.settings().setAttribute(
QtWebKit.QWebSettings.PluginsEnabled,
kargs.get('PluginsEnabled', False)
)
self.settings().setAttribute(
QtWebKit.QWebSettings.PrivateBrowsingEnabled,
kargs.get('PrivateBrowsingEnabled', True)
)
class Browser(QtWebKit.QWebView):
def __init__(self, page):
QtWebKit.QWebView.__init__(self)
self.setPage(page)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
page = Page()
browser = Browser(page)
browser.load(QtCore.QUrl('http://bnd.de'))
browser.show()
sys.exit(app.exec_())
####################################################################
# gtk webkit script
####################################################################
#!/usr/bin/python env
# -*- codong: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk
import webkit
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect('destroy', lambda x: gtk.main_quit())
window.set_size_request(800, 600)
browser = webkit.WebView()
settings = browser.get_settings()
settings.set_property('enable_scripts', False)
settings.set_property('enable_plugins', False)
settings.set_property('enable_java_applet', False)
settings.set_property('enable_private_browsing', True)
window.add(browser)
browser.open('http://bnd.de')
window.show_all()
gtk.main()
More information about the PyQt
mailing list