Bug 246188

Summary: [PATCH] Amarok crashes when trying to play something [@Phonon::VLC::VLCMediaObject::setVLCWidgetId]
Product: [Frameworks and Libraries] phonon-backend-vlc Reporter: perrantrevan
Component: generalAssignee: Martin Sandsmark <martin.sandsmark>
Status: RESOLVED FIXED    
Severity: crash CC: bcooksley, benwilby, fabo, jb, martin.sandsmark, mschiff, myriam, paulo131, valorie.zimmerman
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 0.3.1
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
Patch to correct the bug

Description perrantrevan 2010-07-29 21:21:04 UTC
Application: amarok (2.3-GIT)
KDE Platform Version: 4.4.92 (KDE 4.4.92 (KDE 4.5 RC2))
Qt Version: 4.7.0
Operating System: Linux 2.6.32-24-generic x86_64
Distribution: Ubuntu 10.04.1 LTS

-- Information about the crash:
- What I was doing when the application crashed:

Just updated via git-pull and compiled. There is an Error 1 about a missing icon but this did not stop the program working before.

Now I get a segmentation fault, hence the backtrace.

The crash can be reproduced every time.

-- Backtrace:
Application: Amarok (amarok), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f902693e7a0 (LWP 4561))]

Thread 3 (Thread 0x7f8fd77c3710 (LWP 4565)):
#0  0x00007f902117585c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f900c911872 in LoopRequest (data=0xae5c70) at playlist/thread.c:539
#2  Thread (data=0xae5c70) at playlist/thread.c:586
#3  0x00007f90211709ca in start_thread () from /lib/libpthread.so.0
#4  0x00007f90236956fd in clone () from /lib/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f8fd76c2710 (LWP 4568)):
#0  0x00007f902368dfe3 in select () from /lib/libc.so.6
#1  0x00007f9023ff427e in qt_safe_select (nfds=14, fdread=0x7f8fd76c0c90, fdwrite=0x7f8fd76c0c10, fdexcept=0x0, orig_timeout=0x0) at kernel/qcore_unix.cpp:82
#2  0x00007f9023fa45ea in select_msecs (nfds=14, fdread=0x7f8fd76c0c90, fdwrite=0x7f8fd76c0c10, timeout=<value optimized out>) at io/qprocess_unix.cpp:880
#3  0x00007f9023fa5319 in QProcessPrivate::waitForFinished (this=0x1e702e0, msecs=-1) at io/qprocess_unix.cpp:1101
#4  0x00007f9023f63fea in QProcess::waitForFinished (this=0x7f8fd76c0db0, msecs=-1) at io/qprocess.cpp:1698
#5  0x00007f9023f69b58 in QProcess::execute (program=..., arguments=...) at io/qprocess.cpp:2092
#6  0x00007f9024454210 in KToolInvocation::startKdeinit() () from /usr/lib/libkdecore.so.5
#7  0x00007f90244543c0 in KToolInvocation::klauncher() () from /usr/lib/libkdecore.so.5
#8  0x00007f9024509496 in ?? () from /usr/lib/libkdecore.so.5
#9  0x00007f902450a015 in KSycoca::findFactory(KSycocaFactoryId) () from /usr/lib/libkdecore.so.5
#10 0x00007f902450dab7 in KSycocaFactory::KSycocaFactory(KSycocaFactoryId) () from /usr/lib/libkdecore.so.5
#11 0x00007f902445fd6b in KMimeTypeFactory::KMimeTypeFactory() () from /usr/lib/libkdecore.so.5
#12 0x00007f90244602fa in KMimeTypeFactory::self() () from /usr/lib/libkdecore.so.5
#13 0x00007f90244695e3 in KMimeType::findByUrlHelper(KUrl const&, unsigned int, bool, QIODevice*, int*) () from /usr/lib/libkdecore.so.5
#14 0x00007f9024469c3b in KMimeType::findByUrl(KUrl const&, unsigned int, bool, bool, int*) () from /usr/lib/libkdecore.so.5
#15 0x00007f902446a08e in KMimeType::findByPath(QString const&, unsigned int, bool, int*) () from /usr/lib/libkdecore.so.5
#16 0x00007f9025a83855 in MimeFileTypeResolver::createFile (this=0x947840, fileName=0x1e5d9f0 "/media/Data/Music/S/Stevie Wonder/Songs in the Key of Life/05 - Sir Duke.mp3", readProperties=true, 
    propertiesStyle=TagLib::AudioProperties::Average) at /home/pepe/kde/src/amarok/shared/taglib_filetype_resolvers/mimefiletyperesolver.cpp:53
#17 0x00007f901fb8b4ea in TagLib::FileRef::create(char const*, bool, TagLib::AudioProperties::ReadStyle) () from /usr/lib/libtag.so.1
#18 0x00007f901fb8be7c in TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle) () from /usr/lib/libtag.so.1
#19 0x00007f8fe3abebec in ReadMeta (p_this=0x1e5e180) at taglib.cpp:369
#20 0x00007f900c96c51f in module_need (p_this=0x1e5e180, psz_capability=<value optimized out>, psz_name=<value optimized out>, b_strict=<value optimized out>) at modules/modules.c:559
#21 0x00007f900c932e87 in InputSourceMeta (p_input=0x1e40b50, p_source=<value optimized out>, p_meta=0x1e5e020) at input/input.c:2751
#22 0x00007f900c935f7d in Init (p_input=0x1e40b50) at input/input.c:1287
#23 0x00007f900c937215 in input_Preparse (p_parent=<value optimized out>, p_item=<value optimized out>) at input/input.c:195
#24 0x00007f900c9178ed in Preparse (data=<value optimized out>) at playlist/preparser.c:140
#25 Thread (data=<value optimized out>) at playlist/preparser.c:220
#26 0x00007f90211709ca in start_thread () from /lib/libpthread.so.0
#27 0x00007f90236956fd in clone () from /lib/libc.so.6
#28 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f902693e7a0 (LWP 4561)):
[KCrash Handler]
#6  0x00007f90249e1c3b in QWidget::testAttribute_helper (this=0x0, attribute=Qt::WA_WState_Created) at kernel/qwidget.cpp:10718
#7  0x00007f90249efefe in QWidget::testAttribute (this=0x0) at ../../include/QtGui/../../src/gui/kernel/qwidget.h:1031
#8  QWidget::winId (this=0x0) at kernel/qwidget.cpp:2390
#9  0x00007f900ce05b12 in Phonon::VLC::VLCMediaObject::setVLCWidgetId (this=0xe6b0a0) at /home/pepe/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:128
#10 0x00007f900ce05d23 in Phonon::VLC::VLCMediaObject::playInternal (this=0xe6b0a0) at /home/pepe/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:179
#11 0x00007f900cdfe4cc in Phonon::VLC::MediaObject::play (this=0xe6b0a0) at /home/pepe/kde/src/phonon-vlc/vlc/mediaobject.cpp:120
#12 0x00007f9025ac8afa in EngineController::playUrl (this=0xa16ae0, url=..., offset=11407) at /home/pepe/kde/src/amarok/src/EngineController.cpp:503
#13 0x00007f9025ac7fb3 in EngineController::play (this=0xa16ae0, track=..., offset=11407) at /home/pepe/kde/src/amarok/src/EngineController.cpp:403
#14 0x00007f9025ac754d in EngineController::restoreSession (this=0xa16ae0) at /home/pepe/kde/src/amarok/src/EngineController.cpp:309
#15 0x00007f9025ab6f87 in App::continueInit (this=0x7fffb242f050) at /home/pepe/kde/src/amarok/src/App.cpp:691
#16 0x00007f9025ab28f1 in App (this=0x7fffb242f050) at /home/pepe/kde/src/amarok/src/App.cpp:210
#17 0x000000000040b006 in main (argc=1, argv=0x7fffb2430fa8) at /home/pepe/kde/src/amarok/src/main.cpp:235

Possible duplicates by query: bug 219177, bug 204465, bug 202713.

Reported using DrKonqi
Comment 1 Myriam Schweingruber 2010-07-30 12:00:37 UTC
The crash is in the Phonon VLC backend, reassigning.
Comment 2 Myriam Schweingruber 2010-07-30 12:14:42 UTC
Confirmed, tis is the debug output I get on the Konsole:


[0x2446d28] main input debug: Creating an input for '001-air-space_maker.mp3'
amarok:             [EngineController] Artist     :  ("") 
amarok:             [EngineController] Album      :  ("") 
amarok:             [EngineController] Title      :  ("001-air-space_maker.mp3") 
amarok:             [EngineController] Genre      :  ("") 
amarok:             [EngineController] Tracknumber:  ("") 
amarok:             [EngineController] Length     :  () 
amarok:             [EngineController] Track changed:  true 
amarok:             BEGIN: void Engine::EngineSubject::newMetaDataNotify(const QHash<long long int, QString>&, bool) 
amarok:               BEGIN: virtual void ScrobblerAdapter::engineNewMetaData(const QHash<long long int, QString>&, bool) 
amarok:               END__: virtual void ScrobblerAdapter::engineNewMetaData(const QHash<long long int, QString>&, bool) - Took 0.00014s 
amarok:               BEGIN: virtual void Context::ContextView::engineNewMetaData(const QHash<long long int, QString>&, bool) 
amarok:               END__: virtual void Context::ContextView::engineNewMetaData(const QHash<long long int, QString>&, bool) - Took 0.00012s 
amarok:             END__: void Engine::EngineSubject::newMetaDataNotify(const QHash<long long int, QString>&, bool) - Took 0.0006s 
amarok:           END__: void EngineController::slotMetaDataChanged() - Took 0.18s 
QSocketNotifier: Invalid socket 61 and type 'Read', disabling...
[0x1391068] main playlist debug: no fetch required for (null) (art currently (null))
Comment 3 Myriam Schweingruber 2010-07-30 12:18:54 UTC
And another backtrace:


Thread 1 (Thread 0x7ffa4a1c0780 (LWP 4080)):
[KCrash Handler]
#6  0x00007ffa48256c3b in QWidget::testAttribute_helper (this=0x6e006100690072, attribute=Qt::WA_WState_Created) at kernel/qwidget.cpp:10718
#7  0x00007ffa48264efe in QWidget::testAttribute (this=0x6e006100690072) at ../../include/QtGui/../../src/gui/kernel/qwidget.h:1031
#8  QWidget::winId (this=0x6e006100690072) at kernel/qwidget.cpp:2390
#9  0x00007ffa31cbab22 in Phonon::VLC::VLCMediaObject::setVLCWidgetId (this=0x10a8cd0) at /home/myriam/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:128
#10 0x00007ffa31cbad33 in Phonon::VLC::VLCMediaObject::playInternal (this=0x10a8cd0) at /home/myriam/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:179
#11 0x00007ffa31cb34dc in Phonon::VLC::MediaObject::play (this=0x10a8cd0) at /home/myriam/kde/src/phonon-vlc/vlc/mediaobject.cpp:120
#12 0x00007ffa49348846 in EngineController::playUrl (this=0x10be950, url=..., offset=0) at /home/myriam/kde/src/amarok/src/EngineController.cpp:503
#13 0x00007ffa49347cff in EngineController::play (this=0x10be950, track=..., offset=0) at /home/myriam/kde/src/amarok/src/EngineController.cpp:403
#14 0x00007ffa48f7a9f6 in Playlist::Actions::play (this=0x185b720, trackid=3018580614335094871, now=true) at /home/myriam/kde/src/amarok/src/playlist/PlaylistActions.cpp:232
#15 0x00007ffa48f7a76d in Playlist::Actions::play (this=0x185b720, index=...) at /home/myriam/kde/src/amarok/src/playlist/PlaylistActions.cpp:198
#16 0x00007ffa4902bbf2 in Playlist::PrettyListView::trackActivated (this=0x23c34a0, idx=...) at /home/myriam/kde/src/amarok/src/playlist/view/listview/PrettyListView.cpp:289
#17 0x00007ffa4903064f in Playlist::PrettyListView::qt_metacall (this=0x23c34a0, _c=QMetaObject::InvokeMetaMethod, _id=22, _a=0x7fff210115a0)
    at /home/myriam/kde/build/amarok/src/PrettyListView.moc:148
#18 0x00007ffa478577a7 in QMetaObject::activate (sender=0x23c34a0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x1c) at kernel/qobject.cpp:3280
#19 0x00007ffa4874f4b5 in QAbstractItemView::doubleClicked (this=0x6e006100690072, _t1=<value optimized out>) at .moc/release-shared/moc_qabstractitemview.cpp:338
#20 0x00007ffa48752062 in QAbstractItemView::mouseDoubleClickEvent (this=0x23c34a0, event=0x7fff21012310) at itemviews/qabstractitemview.cpp:1821
#21 0x00007ffa482632e2 in QWidget::event (this=0x23c34a0, event=0x7fff21012310) at kernel/qwidget.cpp:8161
#22 0x00007ffa48627b06 in QFrame::event (this=0x23c34a0, e=0x7fff21012310) at widgets/qframe.cpp:557
#23 0x00007ffa4875f7ab in QAbstractItemView::viewportEvent (this=0x23c34a0, event=0x7fff21012310) at itemviews/qabstractitemview.cpp:1619
#24 0x00007ffa4783f2b7 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<value optimized out>, receiver=0x21533c0, event=0x7fff21012310) at kernel/qcoreapplication.cpp:847
#25 0x00007ffa4820dcac in QApplicationPrivate::notify_helper (this=0xf34fe0, receiver=0x21533c0, e=0x7fff21012310) at kernel/qapplication.cpp:4385
#26 0x00007ffa48213fee in QApplication::notify (this=0x7fff21012fc0, receiver=0x21533c0, e=0x7fff21012310) at kernel/qapplication.cpp:3952
#27 0x00007ffa49bdd926 in KApplication::notify (this=0x7fff21012fc0, receiver=0x21533c0, event=0x7fff21012310) at ../../kdeui/kernel/kapplication.cpp:309
#28 0x00007ffa4783fa8c in QCoreApplication::notifyInternal (this=0x7fff21012fc0, receiver=0x21533c0, event=0x7fff21012310) at kernel/qcoreapplication.cpp:732
#29 0x00007ffa48212a9e in QCoreApplication::sendEvent (receiver=0x21533c0, event=0x7fff21012310, alienWidget=0x21533c0, nativeWidget=0x1c36fd0, buttonDown=<value optimized out>, 
    lastMouseReceiver=<value optimized out>, spontaneous=true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#30 QApplicationPrivate::sendMouseEvent (receiver=0x21533c0, event=0x7fff21012310, alienWidget=0x21533c0, nativeWidget=0x1c36fd0, buttonDown=<value optimized out>, 
    lastMouseReceiver=<value optimized out>, spontaneous=true) at kernel/qapplication.cpp:3051
#31 0x00007ffa48295335 in QETWidget::translateMouseEvent (this=0x1c36fd0, event=<value optimized out>) at kernel/qapplication_x11.cpp:4403
#32 0x00007ffa48293c6c in QApplication::x11ProcessEvent (this=<value optimized out>, event=0x7fff21012c30) at kernel/qapplication_x11.cpp:3536
#33 0x00007ffa482bfe82 in x11EventSourceDispatch (s=0xf3fc10, callback=<value optimized out>, user_data=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:146
#34 0x00007ffa3f5f78c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#35 0x00007ffa3f5fb748 in ?? () from /lib/libglib-2.0.so.0
#36 0x00007ffa3f5fb8fc in g_main_context_iteration () from /lib/libglib-2.0.so.0
#37 0x00007ffa4786bb83 in QEventDispatcherGlib::processEvents (this=0xdd4030, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#38 0x00007ffa482bf7ee in QGuiEventDispatcherGlib::processEvents (this=0x6e006100690072, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#39 0x00007ffa4783e7b2 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#40 0x00007ffa4783eb9c in QEventLoop::exec (this=0x7fff21012f60, flags=) at kernel/qeventloop.cpp:201
#41 0x00007ffa47842c4b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009
#42 0x000000000040b026 in main (argc=4, argv=0x7fff21014f18) at /home/myriam/kde/src/amarok/src/main.cpp:237
Comment 4 Valorie Zimmerman 2010-08-03 08:44:25 UTC
Created attachment 49765 [details]
New crash information added by DrKonqi

amarok (2.3-GIT) on KDE Platform 4.4.92 (KDE 4.4.92 (KDE 4.5 RC2)) using Qt 4.7.0

- What I was doing when the application crashed: testing out freshly built phonon-vlc backend

- Custom settings of the application: set phonon-vlc to be the backend and tried to play a track. Amarok immediatedly crashed. Restarted Amarok (also built from GIT today), tried playing another track with the same results.

-- Backtrace (Reduced):
#4  0x00007f3abeb58c3f in QWidget::testAttribute_helper (this=0x192d0c0, attribute=Qt::WA_WState_Created) at kernel/qwidget.cpp:10718
#5  0x00007f3abeb66efe in QWidget::testAttribute (this=0x192d0c0) at ../../include/QtGui/../../src/gui/kernel/qwidget.h:1031
#6  QWidget::winId (this=0x192d0c0) at kernel/qwidget.cpp:2390
#7  0x00007f3aa8a6cb12 in Phonon::VLC::VLCMediaObject::setVLCWidgetId (this=0x192f450) at /home/valorie/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:128
#8  0x00007f3aa8a6cd23 in Phonon::VLC::VLCMediaObject::playInternal (this=0x192f450) at /home/valorie/kde/src/phonon-vlc/vlc/vlcmediaobject.cpp:179
Comment 5 Myriam Schweingruber 2010-08-03 09:11:38 UTC
commit 5e49d24 seems to be the culprit
Comment 6 Paul Balança 2010-08-03 19:31:47 UTC
I add the same issue and same kind of backtrace when trying to play a test sound file in KDE systemsettings after selecting VLC engine.
Comment 7 Paul Balança 2010-08-05 09:45:45 UTC
I looked at the source code, and it seems to me that the issue is about p_video_widget variable.
It should be initialized to NULL in MediaObject constructor, and in VLCMediaObject::playInternal(), one should add if(p_video_widget) before  setVLCWidgetId(); in order to assign a video widget to vlc only if it exists.

It solves the bug for me, at least in systemsettings and amarok from what I have seen. I am not an expert, but I can try to post a patch if you want.
Comment 8 Ben Cooksley 2010-08-05 09:49:24 UTC
Please post the patch.
Comment 9 Paul Balança 2010-08-05 13:12:51 UTC
Here it is. Hope i did it in the correct way, I never used git before !

diff --git a/vlc/mediaobject.cpp b/vlc/mediaobject.cpp
index 4109e6f..e086f32 100644
--- a/vlc/mediaobject.cpp
+++ b/vlc/mediaobject.cpp
@@ -50,6 +50,7 @@ MediaObject::MediaObject(QObject *p_parent)
 {
     currentState = Phonon::StoppedState;
     i_video_widget_id = 0;
+    p_video_widget = NULL;
     b_prefinish_mark_reached_emitted = false;
     b_about_to_finish_emitted = false;
     i_transition_time = 0;
diff --git a/vlc/vlcmediaobject.cpp b/vlc/vlcmediaobject.cpp
index 62e071d..347447c 100644
--- a/vlc/vlcmediaobject.cpp
+++ b/vlc/vlcmediaobject.cpp
@@ -176,7 +176,8 @@ void VLCMediaObject::playInternal()
     // This will reset the GUI
     clearMediaController();
 
-    setVLCWidgetId();
+    if(p_video_widget)
+        setVLCWidgetId();
 
     // Play
     if(libvlc_media_player_play(p_vlc_media_player))
Comment 10 Paul Balança 2010-08-05 13:14:36 UTC
Created attachment 49833 [details]
Patch to correct the bug
Comment 11 Myriam Schweingruber 2010-08-05 14:50:33 UTC
*** Bug 246781 has been marked as a duplicate of this bug. ***
Comment 12 Myriam Schweingruber 2010-08-06 12:18:10 UTC
*** Bug 246852 has been marked as a duplicate of this bug. ***
Comment 13 Myriam Schweingruber 2010-08-06 18:59:59 UTC
Fixed by commit http://gitorious.org/phonon/phonon-vlc/commit/88fb405d16806dac8e2c537d40931e4bea6cfdd0
Comment 14 Myriam Schweingruber 2011-04-27 21:32:46 UTC
Reassigning to the new bugzilla product for better bug tracing of the various
backends. Sorry for the noise.