[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok-devel
Subject:    [amarok] src/context/engines/wikipedia: Fix crashes on track change (both with Phonon-GStreamer and
From:       Mark Kretschmann <kretschmann () kde ! org>
Date:       2013-05-08 10:42:49
Message-ID: 20130508104249.7D575A605B () git ! kde ! org
[Download RAW message or body]

Git commit d13bd61842627ffb2382b5d59a020ea7a5124ca5 by Mark Kretschmann.
Committed on 08/05/2013 at 12:29.
Pushed by markey into branch 'master'.

Fix crashes on track change (both with Phonon-GStreamer and Phonon-VLC).

What happened:

The Wikipedia applet uses QtWebKit for HTML rendering. On
Linux, QtWebKit uses GStreamer for media playback. Turns out that this \
crashes with a high probability whenever an <audio> tag is present on a web \
page. As music artists' pages often contain audio snippets in Vorbis \
format, it crashed a lot when Amarok's applet rendered a page.

The fix:

Removing all audio tags from Wikipedia pages before rendering them in our \
applet. Of course, the real fix would have to be done upstream. But until \
that happens, our workaround here fixes a shitload of crashes.

We might want to do a 2.7.1 release for Linux, with this patch.

CCMAIL: amarok-devel@kde.org

M  +14   -0    src/context/engines/wikipedia/WikipediaEngine.cpp

http://commits.kde.org/amarok/d13bd61842627ffb2382b5d59a020ea7a5124ca5

diff --git a/src/context/engines/wikipedia/WikipediaEngine.cpp \
b/src/context/engines/wikipedia/WikipediaEngine.cpp index 94910e7..0692b8d \
                100644
--- a/src/context/engines/wikipedia/WikipediaEngine.cpp
+++ b/src/context/engines/wikipedia/WikipediaEngine.cpp
@@ -818,6 +818,20 @@ WikipediaEnginePrivate::wikiParse( QString &wiki )
         }
     }
 
+    { // remove <audio> tags (can lead to crashes in QtWebKit)
+        const QString tag    = QLatin1String("<audio");
+        const QString tagEnd = QLatin1String("</audio>");
+        const int tagEndSize = tagEnd.size();
+        int matchIndex = 0;
+        QStringMatcher tagMatcher( tag );
+        while( (matchIndex = tagMatcher.indexIn(wiki, matchIndex)) != -1 )
+        {
+            const int nToTagEnd = wiki.indexOf( tagEnd, matchIndex ) - \
matchIndex; +            QStringRef tagRef = wiki.midRef( matchIndex, \
nToTagEnd + tagEndSize ); +            wiki.remove( tagRef.toString() );
+        }
+    }
+
     // Adding back style and license information
     wiki = QLatin1String("<div id=\"bodyContent\"") + wiki;
     wiki += copyright;
_______________________________________________
Amarok-devel mailing list
Amarok-devel@kde.org
https://mail.kde.org/mailman/listinfo/amarok-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic