Bug 147126 - amarok freezes when trying to play mp3 files without mp3 support
Summary: amarok freezes when trying to play mp3 files without mp3 support
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.4.5
Platform: unspecified Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-23 13:15 UTC by Maxime Gamboni
Modified: 2007-08-31 14:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Gamboni 2007-06-23 13:15:51 UTC
Version:           1.4.5 (using KDE 3.5.6, Kubuntu (feisty) 4:3.5.6-0ubuntu14)
Compiler:          Target: x86_64-linux-gnu
OS:                Linux (x86_64) release 2.6.20-15-generic

Trying to play an mp3 file without having mp3 support (i.e. libxine-extracodecs) freezes amarok. 

(Although it's a crash I believe this is a low priority problem, as I can just install them manually, after which the problem, obviously, doesn't occur anymore).

Specifically:
1. I double-clicked on an album containing .mp3 files
2. A dialog pops up. I guess the dialog was supposed to contain a message like "you don't have mp3 support, would you like to install it now?". However in my case it just showed the "install mp3 support" and "cancel" buttons, and no text. (Might be a missing message from French localisation?)
3. Trying to click on either of the dialog buttons, tabbing, pressing enter, etc had no effect.
4. I went to another workspace and when I came back the dialog and the amarok window were not redrawing, i.e they had frozen. Pressing alt-f4 had no effect, except the kde "application not responding dialog".
5. I tried again, hoping to do a screenshot, but the dialog didn't appear anymore - it would just freeze amarok straight again.

Also, just before freezing, amarok sends the message "Very strange! got a DCOPReply opcode, but we were not waiting for a reply!" to stdout.

Note that the application freezes but doesn't crash - so I don't have a backtrace ...
Comment 1 saschasommer 2007-08-27 17:12:37 UTC
The problem is still there with 1.4.7.
Steps to reproduce:
setup amarok to use the xine engine
remove mp3 support from xine
Install following service
/opt/kde3/share/services/amarok_xine-mp3_install.desktop

[Desktop Entry]
Encoding=UTF-8
Type=Service
ServiceTypes=Amarok/CodecInstall
X-KDE-Amarok-codec=mp3
X-KDE-Amarok-engine=xine-engine
Exec=echo blah > /tmp/log

Now if you have a mp3 file laying in your home the popup will work as expected but if you start it without a mp3 file in your home dir or playlist and try to add a mp3 file to the playlist amarok will freeze the moment the dialog pops up.
Comment 2 Mark Kretschmann 2007-08-31 14:27:29 UTC
SVN commit 706845 by markey:

Fixed possible GUI freeze when Amarok was showing the dialog for installing mp3 support. Patch by Sascha Sommer <ssommer@suse.de>.

"The problem seems to be that EngineController::canDecode runs in a seperate
thread than the gui thread. Opening up a Kmessagebox there will prevent
amarok from handling all gui events and everything will freeze. I therefore
put the dialog into an extra function that will later get called from the
statusBar."

BUG: 147126



 M  +4 -0      ChangeLog  
 M  +15 -7     src/enginecontroller.cpp  
 M  +1 -0      src/enginecontroller.h  
 M  +8 -3      src/statusbar/statusBarBase.cpp  


--- branches/stable/extragear/multimedia/amarok/ChangeLog #706844:706845
@@ -2,8 +2,12 @@
 ================
 (C) 2002-2007 the Amarok authors.
 
+
 VERSION 1.4.8
   BUGFIXES:
+    * Fixed possible GUI freeze when Amarok was showing the dialog for
+      installing mp3 support. Patch by Sascha Sommer <ssommer@suse.de>.
+      (BR 147126)
     * Amarok could needlessely reinitialize connections to MySQL databases
       after a configuration change.  Combined with a bug in MySQL libraries,
       this could lead to a crash.
--- branches/stable/extragear/multimedia/amarok/src/enginecontroller.cpp #706844:706845
@@ -244,13 +244,10 @@
     if( engine() != EngineController::instance()->m_voidEngine )
     {
         //we special case this as otherwise users hate us
-        if ( !valid && ext.lower() == "mp3" && !installDistroCodec(AmarokConfig::soundSystem()) )
-            Amarok::StatusBar::instance()->longMessageThreadSafe(
-                    i18n( "<p>The %1 claims it <b>cannot</b> play MP3 files."
-                        "<p>You may want to choose a different engine from the <i>Configure Dialog</i>, or examine "
-                        "the installation of the multimedia-framework that the current engine uses. "
-                        "<p>You may find useful information in the <i>FAQ</i> section of the <i>Amarok HandBook</i>." )
-                    .arg( AmarokConfig::soundSystem() ), KDE::StatusBar::Error );
+        if ( !valid && ext.lower() == "mp3"){
+            QCustomEvent * e = new QCustomEvent( 2000 );
+            QApplication::postEvent( Amarok::StatusBar::instance(), e );
+	}
 
         // Cache this result for the next lookup
         if ( !ext.isEmpty() )
@@ -260,6 +257,17 @@
     return valid;
 }
 
+void EngineController::unplayableNotification() {
+
+    if( !installDistroCodec(AmarokConfig::soundSystem()))
+        Amarok::StatusBar::instance()->longMessageThreadSafe(
+                  i18n( "<p>The %1 claims it <b>cannot</b> play MP3 files."
+                        "<p>You may want to choose a different engine from the <i>Configure Dialog</i>, or examine "
+                        "the installation of the multimedia-framework that the current engine uses. "
+                        "<p>You may find useful information in the <i>FAQ</i> section of the <i>Amarok HandBook</i>." )
+                    .arg( AmarokConfig::soundSystem() ), KDE::StatusBar::Error );
+}
+
 bool EngineController::installDistroCodec( const QString& engine /*Filetype type*/)
 {
     KService::Ptr service = KTrader::self()->query( "Amarok/CodecInstall"
--- branches/stable/extragear/multimedia/amarok/src/enginecontroller.h #706844:706845
@@ -52,6 +52,7 @@
     uint                     trackPosition() const;
 
     EngineBase* loadEngine();
+    void unplayableNotification();
 
     uint trackLength() const { return m_bundle.length() * 1000; }
     const MetaBundle &bundle() const;
--- branches/stable/extragear/multimedia/amarok/src/statusbar/statusBarBase.cpp #706844:706845
@@ -25,6 +25,7 @@
 #include "squeezedtextlabel.h"
 #include "statusBarBase.h"
 #include "threadmanager.h"
+#include "enginecontroller.h"
 
 #include <kio/job.h>
 #include <kiconloader.h>
@@ -343,9 +344,13 @@
 void
 StatusBar::customEvent( QCustomEvent *e )
 {
-    QString *s = static_cast<QString*>( e->data() );
-    longMessage( *s );
-    delete s;
+    if(e->type() == 1000 ){ 
+      QString *s = static_cast<QString*>( e->data() );
+      longMessage( *s );
+      delete s;
+    }else if(e->type() == 2000 ){
+      EngineController::instance()->unplayableNotification();
+    }
 }