Bug 279188

Summary: Launching amarok with --cdplay doesn't add the CD to playlist
Product: [Applications] amarok Reporter: Jonathan Marten <jjm>
Component: Collections/CDAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: minor CC: e.m.a.t.i.r.o.v, t.gornak
Priority: NOR Flags: myriam: Usability+
Version: 2.8.0   
Target Milestone: 2.9   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jonathan Marten 2011-08-02 17:15:19 UTC
Application: amarok (2.4-GIT)
KDE Platform Version: 4.7.40 (4.7.40 (KDE 4.8 >= 20110623) (Compiled from sources)
Qt Version: 4.7.1
Operating System: Linux 2.6.38-gentoo-r6 i686
Distribution (Platform): Gentoo Packages

-- Information about the crash:
With an audio CD in the drive, executed the command in a terminal:

amarok -d --cdplay

This produced the attached backtrace and log output as follows:

KGlobal::locale::Warning your global KLocale is being recreated with a valid main component  instead of a fake component, this usually means you tried to call i18n related functions b efore your main component was created. You should not do that since it most likely will not  work 
amarok: BEGIN: App::App() 
amarok:   BEGIN: void App::continueInit() 
amarok:     BEGIN: EngineController::EngineController() 
amarok:     END__: EngineController::EngineController() [Took: 0s] 
amarok:     BEGIN: void EngineController::initializePhonon() 
amarok(12757)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from " /var/tmp/kdecache-jjm/ksycoca4"

(amarok:12757): GStreamer-CRITICAL **: gst_debug_add_log_function: assertion `func != NULL'  failed
amarok(12757) Phonon::KdePlatformPlugin::createBackend: using backend:  "GStreamer"
amarok:       [EngineController] Tick Interval (actual):  100 
amarok:     END__: void EngineController::initializePhonon() [Took: 0.18s] 
amarok:     BEGIN: virtual int App::newInstance() 
amarok:       BEGIN: static void App::handleCliArgs() 
amarok:         BEGIN: bool MainWindow::playAudioCd() 
amarok:           BEGIN: CollectionManager::CollectionManager() 
amarok:           END__: CollectionManager::CollectionManager() [Took: 0s] 
amarok:           [MainWindow] waiting for cd... 
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = amarok path = /usr/home/ws/trunk/inst-new20jun2011/bin pid = 127 57
KCrash: Arguments: /usr/home/ws/trunk/inst-new20jun2011/bin/amarok --nocrashhandler -d --cd play 
KCrash: Attempting to start /ws/trunk/inst/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/jjm/.kde4/socket-keelhaul/kdeinit4__0
unnamed app(12756): Communication problem with  "amarok" , it probably crashed. 
Error message was:  "org.freedesktop.DBus.Error.NoReply" : " "Message did not receive a rep ly (timeout by message bus)" " 

This could be the same crash as at bug 274706 (itself a duplicate of bug 249037), but those bugs claim to have been fixed in Git in June 2011.  Compiled sources are the latest revision as of this morning:

$ git describe
v2.4.0-760-gaba12e0
$ amarok --version
Qt: 4.7.1
KDE Development Platform: 4.7.40 (4.7.40 (KDE 4.8 >= 20110623)
Amarok: 2.4-GIT

The crash can be reproduced every time.

-- Backtrace:
Application: Amarok (amarok), signal: Segmentation fault
[KCrash Handler]
#7  0xb7001b65 in MainWindow::playAudioCd (this=0x0) at /ws/trunk/extragear/amarok/src/MainWindow.cpp:1299
#8  0xb6fe8e75 in App::handleCliArgs () at /ws/trunk/extragear/amarok/src/App.cpp:315
#9  0xb6fe933c in App::newInstance (this=0xbfdafb98) at /ws/trunk/extragear/amarok/src/App.cpp:749
#10 0xb7641980 in KUniqueApplicationAdaptor::newInstance (this=0x90af898, asn_id=..., args=...) at /ws/trunk/kdelibs/kdeui/kernel/kuniqueapplication.cpp:442
#11 0xb7641a34 in KUniqueApplicationAdaptor::qt_metacall (this=0x90af898, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfdaee88) at /ws/BUILD.keelhaul/kdelibs--trunk-BUILD/kdeui/kuniqueapplication_p.moc:81
#12 0xb5222a0c in QDBusConnectionPrivate::deliverCall (this=0x9054280, object=0x90af898, msg=..., metaTypes=..., slotIdx=0) at qdbusintegrator.cpp:919
#13 0xb5223edc in QDBusConnectionPrivate::activateCall (this=0x9054280, object=0x90af898, flags=337, msg=...) at qdbusintegrator.cpp:822
#14 0xb5224b06 in QDBusConnectionPrivate::activateObject (this=0x9054280, node=..., msg=..., pathStartPos=-1076170612) at qdbusintegrator.cpp:1379
#15 0xb5224e28 in QDBusActivateObjectEvent::placeMetaCall (this=0x94bdf10) at qdbusintegrator.cpp:1493
#16 0xb5a2c432 in QObject::event (this=0xbfdafb98, e=0xaf5d1720) at kernel/qobject.cpp:1219
#17 0xb5a17d2a in QCoreApplication::event (this=0xbfdafb98, e=0x94bdf10) at kernel/qcoreapplication.cpp:1561
#18 0xb5f6bc3c in QApplication::event (this=0xbfdafb98, e=0x94bdf10) at kernel/qapplication.cpp:2486
#19 0xb6fe5ee8 in App::event (this=0x0, event=0x94bdf10) at /ws/trunk/extragear/amarok/src/App.cpp:732
#20 0xb5f69aec in QApplicationPrivate::notify_helper (this=0x9084b00, receiver=0xbfdafb98, e=0x94bdf10) at kernel/qapplication.cpp:4445
#21 0xb5f72c31 in QApplication::notify (this=0xbfdafb98, receiver=0xbfdafb98, e=0x94bdf10) at kernel/qapplication.cpp:4410
#22 0xb763ba38 in KApplication::notify (this=0xbfdafb98, receiver=0xbfdafb98, event=0x94bdf10) at /ws/trunk/kdelibs/kdeui/kernel/kapplication.cpp:311
#23 0xb5a17db5 in QCoreApplication::notifyInternal (this=0xbfdafb98, receiver=0xbfdafb98, event=0x94bdf10) at kernel/qcoreapplication.cpp:732
#24 0xb5a19442 in sendEvent (receiver=0x0, event_type=0, data=0x8f15e20) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#25 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8f15e20) at kernel/qcoreapplication.cpp:1373
#26 0xb5a4d987 in QEventDispatcherUNIX::processEvents (this=0x8f96c10, flags=...) at kernel/qeventdispatcher_unix.cpp:890
#27 0xb603dc2e in QEventDispatcherX11::processEvents (this=0x8f96c10, flags=...) at kernel/qeventdispatcher_x11.cpp:152
#28 0xb5a1991d in QCoreApplication::processEvents (flags=) at kernel/qcoreapplication.cpp:924
#29 0xb5fd8454 in QWidgetPrivate::show_helper (this=0x94ae758) at kernel/qwidget.cpp:7409
#30 0xb5fd8a93 in QWidget::setVisible (this=0x940ab30, visible=true) at kernel/qwidget.cpp:7602
#31 0xb6c2bf97 in QWidget::show (this=0x940ab30) at /ws/trunk/inst/include/QtGui/qwidget.h:487
#32 0xb6fe6dd6 in App::continueInit (this=0xbfdafb98) at /ws/trunk/extragear/amarok/src/App.cpp:538
#33 0xb6fe9fb0 in App::App (this=0xbfdafb98) at /ws/trunk/extragear/amarok/src/App.cpp:185
#34 0x08056b9b in main (argc=3, argv=0xbfdb05c4) at /ws/trunk/extragear/amarok/src/main.cpp:289

Possible duplicates by query: bug 274706.

Reported using DrKonqi
Comment 1 Myriam Schweingruber 2011-08-02 20:48:02 UTC
What if you open amarok without that option and try to play a CD from there?
Comment 2 Jonathan Marten 2011-08-03 12:49:28 UTC
Insert audio CD then select "Play Audio CD with Amarok" option from the Plasma device notifier => crash as above.

Insert CD then start Amarok from command line or K-menu => nothing happens (no "Audio CD" appears in collection, no attempt made to play).

Insert CD after Amarok has been started => "Audio CD" appears in collection and title/track names appear after a few seconds.  The album or individual tracks can be dragged to playlist, but clicking "Play" does not start playback.  Log messages as follows:

amarok: BEGIN: virtual bool Meta::AudioCdAlbum::isCompilation() const 
amarok: END__: virtual bool Meta::AudioCdAlbum::isCompilation() const [Took: 0s]  
amarok: BEGIN: void EngineController::playPause() 
amarok:   [EngineController] PlayPause: EngineController state 1 
amarok:   BEGIN: void EngineController::play() 
amarok:     BEGIN: void Playlist::Actions::play() 
amarok:       BEGIN: void Playlist::Actions::play(quint64, bool) 
amarok:         BEGIN: void EngineController::play(Meta::TrackPtr, uint) 
amarok:           BEGIN: void EngineController::stop(bool) 
Transitioning to state "ready" 
State change 
Moving from "null" 0 to "ready" 1 
Transitioning to state "ready" 
Setting new source 
New source:  QUrl( "" )  
amarok:           END__: void EngineController::stop(bool) [Took: 0s] 
amarok:           [EngineController] play: bounded is  QObject(0x0)  current "Co mmunication Breakdown" 
amarok:           [EngineController] Just a normal, boring track... :-P 
amarok:           BEGIN: void EngineController::playUrl(const KUrl&, uint) 
amarok:             [EngineController] URL:  KUrl("audiocd:/d411160f/1?device=/d ev/sr1") "audiocd:/d411160f/1?device=/dev/sr1" 
amarok:             [EngineController] Offset:  0 
amarok:             [EngineController] play track from cd 
amarok:             [EngineController] Old device:  "" 
Setting new source 
New source:  QUrl( "" )  
amarok:             [EngineController] New device:  "/dev/sr1" 
Setting new source 
New source:  QUrl( "" )  
amarok:             [EngineController] Track:  1 
amarok:             [EngineController] no boom? 
Transitioning to state "playing" 

(amarok:26648): GLib-GObject-WARNING **: gsignal.c:2392: instance `0xa6a9320' ha s no handler with id `53'
1 
Transitioning to state "null" 
amarok:             [EngineController] track pos after play:  0 
amarok:           END__: void EngineController::playUrl(const KUrl&, uint) [Took : 0.037s]                                                                       
amarok:         END__: void EngineController::play(Meta::TrackPtr, uint) [Took:  0.038s]                                                                         
amarok:       END__: void Playlist::Actions::play(quint64, bool) [Took: 0.038s] 
amarok:     END__: void Playlist::Actions::play() [Took: 0.038s] 
amarok:   END__: void EngineController::play() [Took: 0.038s] 
amarok: END__: void EngineController::playPause() [Took: 0.038s] 
amarok: BEGIN: void EngineController::slotTrackLengthChanged(qint64) 
amarok:   BEGIN: void ProgressWidget::redrawBookmarks(const QString*) 
amarok:   END__: void ProgressWidget::redrawBookmarks(const QString*) [Took: 0s]  
amarok: END__: void EngineController::slotTrackLengthChanged(qint64) [Took: 0s] 
amarok: BEGIN: void EngineController::slotStateChanged(Phonon::State, Phonon::State) 
amarok: END__: void EngineController::slotStateChanged(Phonon::State, Phonon::State) [Took: 0s] 
amarok: BEGIN: virtual bool Meta::AudioCdAlbum::isCompilation() const 
amarok: END__: virtual bool Meta::AudioCdAlbum::isCompilation() const [Took: 0s]  

(Phonon backend is GStreamer, if that is relevant)
Comment 3 Myriam Schweingruber 2011-08-05 07:46:40 UTC
Does the same happen with the phonon-backend-vlc? Also what versions of the phonon backends do you use?
Comment 4 Jonathan Marten 2011-08-05 10:30:24 UTC
With Phonon backend set to VLC:

insert CD while Amarok is running => Audio CD appears in collection, tracks can be dragged to playlist, plays correctly with no apparent problems.

insert CD then start Amarok => nothing happens (no Audio CD appears in collection).

start play from the Plasma device notifier or with the command 'amarok -d --cdplay' when Amarok is not running => crash as above

start play from the Plasma device notifier or with the command 'amarok -d --cdplay' while Amarok is already running => messages as follows, but nothing else happens

$ amarok -d --cdplay
Amarok is already running!
amarok: BEGIN: virtual int App::newInstance() 
amarok:   BEGIN: static void App::handleCliArgs() 
amarok:     BEGIN: bool MainWindow::playAudioCd() 
amarok:       [MainWindow] waiting for cd... 
amarok:     END__: bool MainWindow::playAudioCd() [Took: 0s] 
amarok:   END__: static void App::handleCliArgs() [Took: 0s] 
amarok: END__: virtual int App::newInstance() [Took: 0s] 
$ 

All compiled from sources, versions:

amarok                   v2.4.0-760-gaba12e0
phonon/phonon            4.5.0-100-ge66be3f
phonon/phonon-gstreamer  4.5.1-105-gfb62ed7
phonon/phonon-vlc        0.4.0-54-ge747076
vlc                      1.1.10
Comment 5 Myriam Schweingruber 2011-08-07 10:14:58 UTC
Thank you for the valuable feedback.
Comment 6 Jonathan Marten 2011-11-15 17:33:03 UTC
Confirmed still happening with current build.

$ git describe
v2.4.0-1067-gb05b8fb
$ amarok --version
Qt: 4.8.0
KDE Development Platform: 4.7.3 (4.7.3)
Amarok: 2.4-GIT
Comment 7 Myriam Schweingruber 2012-04-25 23:39:28 UTC
Jonathan: can you still reproduce this with Amarok 2.5 or current 2.5-git?
Comment 8 Jonathan Marten 2012-04-26 19:50:36 UTC
Sorry, still does not seem to be 100% working.

insert CD while Amarok is running => Audio CD appears in collection, tracks can be dragged to playlist, plays correctly with no apparent problems.

insert CD then start Amarok => Audio CD appears in collection and can be played as above.  * This is now working (it didn't work before) *

start play from the Plasma device notifier or with the command 'amarok -d --cdplay' when Amarok is not running => crash as above, same backtrace modulo line numbers.

start play from the Plasma device notifier or with the command 'amarok -d --cdplay' while Amarok is already running => no crash, but nothing else happens

amarok			v2.5.0-220-g141e901
phonon			v4.6.0-26-gc7c200b
phonon-gstreamer	v4.6.0-13-g18cacbe
phonon-vlc		v0.5.0-17-gfd70afe

$ amarok --version
Qt: 4.8.2
KDE Development Platform: 4.8.2 (4.8.2)
Amarok: 2.5-GIT

$ vlc --version
VLC media player 1.1.13 The Luggage (revision exported)

Phonon backend: vlc (but same happens with gstreamer)
Comment 9 Myriam Schweingruber 2012-04-29 20:38:11 UTC
(In reply to comment #8)
> Sorry, still does not seem to be 100% working.
... 
> start play from the Plasma device notifier or with the command 'amarok -d
> --cdplay' while Amarok is already running => no crash, but nothing else
> happens

That last option can't work as you can't run two instances of Amarok without an additional option.
Comment 10 Myriam Schweingruber 2012-09-14 10:12:54 UTC
I can not reproduce this crash in Amarok 2.6 or 2.6-git of today. What doesn't work indeed is that you can't launch a CD to play from the command line or the plasma notifier
Comment 11 Mikhail Ivchenko 2013-12-02 10:22:39 UTC
I can't reproduce this crash but when I run amarok 2.8.0 with --cdplay it doesn't add songs from cd to playlist.
Comment 12 Tuomas Nurmi 2024-03-29 23:44:18 UTC
Git commit 212b693c210f673e9dac91d4c62995e30ad5ecbd by Tuomas Nurmi.
Committed on 29/03/2024 at 23:36.
Pushed by nurmi into branch 'master'.

Fix --cdplay command line option

First, avoid touching MainWindow member variables before MainWindow is
constructed to avoid immediate segfault.

Second, don't try casting cd collection to MemoryCollection, which it doesn't
inherit (at least anymore). Casting to MediaDeviceCollection actually works.
Hard to tell since when this has been broken, but most of relevant code seems
to be last changed in 2010 or earlier, so possibly a while.
Related: bug 482463

M  +2    -2    ChangeLog
M  +8    -4    src/MainWindow.cpp

https://invent.kde.org/multimedia/amarok/-/commit/212b693c210f673e9dac91d4c62995e30ad5ecbd