From cd9c1fc487bb65016930c42af2acf1c620a427d0 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 30 Jun 2010 20:15:12 -0500
Subject: qt: added QtWebKit_Flash.patch to fix crash with Flash 10.1 and
 webkit browsers like mythbrowser. http://trac.webkit.org/changeset/61307

---
 abs/core-testing/qt/PKGBUILD             | 25 +++++++++--------
 abs/core-testing/qt/QtWebKit_Flash.patch | 48 ++++++++++++++++++++++++++++++++
 abs/core-testing/qt/__changelog          |  1 +
 3 files changed, 63 insertions(+), 11 deletions(-)
 mode change 100644 => 100755 abs/core-testing/qt/PKGBUILD
 create mode 100644 abs/core-testing/qt/QtWebKit_Flash.patch

diff --git a/abs/core-testing/qt/PKGBUILD b/abs/core-testing/qt/PKGBUILD
old mode 100644
new mode 100755
index 87ec9f7..e315180
--- a/abs/core-testing/qt/PKGBUILD
+++ b/abs/core-testing/qt/PKGBUILD
@@ -3,11 +3,11 @@
 
 pkgname=qt
 pkgver=4.5.2
-pkgrel=4
+pkgrel=5
 _kdeqtver=2d1727e396d5dca24ae0fb6a45d35ffc1abd0c12
 pkgdesc='A cross-platform application and UI framework'
 arch=('i686' 'x86_64')
-url='http://www.qtsoftware.com/'
+url='http://www.qt.nokia.com/'
 license=('GPL3' 'LGPL')
 depends=('libpng' 'mesa' 'fontconfig' 'libtiff>=3.8.2-5' 'libmng>=1.0.10-2' 'sqlite3'
          'libxrandr' 'glib2' 'libxi' 'dbus' 'libxcursor' 'libxinerama' 'libxrender')
@@ -18,17 +18,10 @@ replaces=('qt4')
 conflicts=('qt4')
 options=('!libtool')
 _pkgfqn="qt-x11-opensource-src-${pkgver}"
-source=("ftp://ftp.qtsoftware.com/qt/source/${_pkgfqn}.tar.bz2"
+source=("http://get.qt.nokia.com/qt/source/${_pkgfqn}.tar.bz2"
         "ftp://ftp.archlinux.org/other/kde-qt/kde-qt-patches-${_kdeqtver}.tar.bz2"
         'assistant.desktop' 'designer.desktop' 'linguist.desktop' 'qtconfig.desktop'
-        'qdoc3.patch')
-md5sums=('28a7e8ac9805a6f614d2a27ee1a6ac9d'
-         '4b333add3031f59538629b35858178d9'
-         'b352b4b70faba2571af3fce5d119580a'
-         '491a96682faa03407f768a53cca71db5'
-         'cda7ed7e132689991dc2968a0043b4b0'
-         '717669b728a0a795217d2f52969e454c'
-         '9c0a0db3569e889a54a6cddcd55c538c')
+        'qdoc3.patch' 'QtWebKit_Flash.patch')
 
 _create-kdeqt-patches() {
 	local codir=$(mktemp -d)
@@ -59,6 +52,7 @@ build() {
 	done
 
 	patch -p0 -i $srcdir/qdoc3.patch
+	patch < $srcdir/QtWebKit_Flash.patch ${srcdir}/${_pkgfqn}/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp || return 1
 
 	sed -i "s|-O2|$CXXFLAGS|" mkspecs/common/g++.conf
 	sed -i "/^QMAKE_RPATH/s| -Wl,-rpath,||g" mkspecs/common/g++.conf
@@ -116,3 +110,12 @@ build() {
 	sed -i -e "s|$srcdir/${_pkgfqn}/bin/moc|/usr/bin/moc|g" $pkgdir/usr/lib/pkgconfig/*.pc
 	sed -i -e "s|$srcdir/${_pkgfqn}/bin/uic|/usr/bin/uic|g" $pkgdir/usr/lib/pkgconfig/*.pc
 }
+
+md5sums=('28a7e8ac9805a6f614d2a27ee1a6ac9d'
+         '4b333add3031f59538629b35858178d9'
+         'b352b4b70faba2571af3fce5d119580a'
+         '491a96682faa03407f768a53cca71db5'
+         'cda7ed7e132689991dc2968a0043b4b0'
+         '717669b728a0a795217d2f52969e454c'
+         '9c0a0db3569e889a54a6cddcd55c538c'
+         '0e2f5e43ed9dba32816fd4142b021762')
diff --git a/abs/core-testing/qt/QtWebKit_Flash.patch b/abs/core-testing/qt/QtWebKit_Flash.patch
new file mode 100644
index 0000000..102f73c
--- /dev/null
+++ b/abs/core-testing/qt/QtWebKit_Flash.patch
@@ -0,0 +1,48 @@
+--- PluginPackageQt.cpp.orig	2010-06-30 21:29:47.178707288 +0000
++++ PluginPackageQt.cpp	2010-06-30 21:35:40.185441603 +0000
+@@ -36,6 +36,8 @@
+ 
+ namespace WebCore {
+ 
++typedef void gtkInitFunc(int *argc, char ***argv); 
++
+ bool PluginPackage::fetchInfo()
+ {
+     if (!load())
+@@ -100,7 +102,8 @@
+ 
+     NP_InitializeFuncPtr NP_Initialize;
+     NPError npErr;
+-
++    gtkInitFunc* gtkInit;
++    
+     NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize");
+     m_NPP_Shutdown = (NPP_ShutdownProcPtr)m_module->resolve("NP_Shutdown");
+ 
+@@ -157,6 +160,26 @@
+     m_browserFuncs.enumerate = _NPN_Enumerate;
+     m_browserFuncs.construct = _NPN_Construct;
+ 
++    // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by
++    // explicitly forcing the initializing of Gtk, i.e. calling gtk_init,
++    // whenver the symbol is present in the plugin library loaded above.
++    // Note that this workaround is based on code from the NSPluginClass ctor
++    // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file.
++    gtkInit = (gtkInitFunc*)m_module->resolve("gtk_init");
++    if (gtkInit) {
++        // Prevent gtk_init() from replacing the X error handlers, since the Gtk
++        // handlers abort when they receive an X error, thus killing the viewer.
++#ifdef Q_WS_X11
++        int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0);
++        int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0);
++#endif
++        gtkInit(0, 0);
++#ifdef Q_WS_X11
++        XSetErrorHandler(old_error_handler);
++        XSetIOErrorHandler(old_io_error_handler);
++#endif
++}
++
+ #if defined(XP_UNIX)
+     npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs);
+ #else
diff --git a/abs/core-testing/qt/__changelog b/abs/core-testing/qt/__changelog
index 2abf977..86af276 100644
--- a/abs/core-testing/qt/__changelog
+++ b/abs/core-testing/qt/__changelog
@@ -1 +1,2 @@
 remove cups support
+added QtWebKit_Flash.patch to fix crash with Flash 10.1 and webkit browsers like mythbrowser. http://trac.webkit.org/changeset/61307  This shouldn't be needed in qt versions 4.6.4 or later.
-- 
cgit v0.12